Skip to content

Commit d315127

Browse files
authored
Merge pull request #64 from sourcefuse/added-pre-commit
Added pre-commit workflow
2 parents b6cf4a1 + 073bbd5 commit d315127

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.github/workflows/pre-commit.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: "Run Pre Commit Checks"
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches:
7+
- '**'
8+
- '!main'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
## run pre-commit
16+
pre-commit:
17+
name: Run pre-commit checks
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
actions: write
23+
pages: write
24+
id-token: write
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
token: ${{ secrets.ARC_JOB_TOKEN }}
31+
32+
- uses: actions/setup-python@v3
33+
34+
- name: Install terraform-docs
35+
run: |
36+
cd /tmp
37+
curl -sSLo ./terraform-docs.tar.gz \
38+
https://terraform-docs.io/dl/v0.16.0/terraform-docs-v0.16.0-$(uname)-amd64.tar.gz
39+
tar -xzf terraform-docs.tar.gz
40+
rm terraform-docs.tar.gz
41+
chmod +x terraform-docs
42+
mv terraform-docs /usr/local/bin/terraform-docs
43+
- name: Install tflint
44+
run: |
45+
cd /tmp
46+
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
47+
- name: Run pre-commit
48+
uses: pre-commit/action@v3.0.0
49+
continue-on-error: true # we want to push the changes pre-commit makes
50+
51+
- name: Push pre-commit changes to branch
52+
uses: stefanzweifel/git-auto-commit-action@v5
53+
with:
54+
commit_message: Push pre-commit changes

.terraform.lock.hcl

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/.terraform.lock.hcl

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)