Repository navigation
46 lines (38 loc) · 1.67 KB
/
Copy pathpre-commit.yaml
File metadata and controls
46 lines (38 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
on:
workflow_call:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Terraform
uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4
- name: Install Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
- name: Install terraform-docs
uses: jaxxstorm/action-install-gh-release@25e24d2d23ae098373794ef1d6faecb48ee52da8 # v3.0.0
with:
repo: terraform-docs/terraform-docs
tag: v0.17.0
- name: Install tflint
uses: jaxxstorm/action-install-gh-release@25e24d2d23ae098373794ef1d6faecb48ee52da8 # v3.0.0
with:
repo: terraform-linters/tflint
tag: v0.55.1
- name: Install pre-commit
env:
WORKFLOW_REPOSITORY: ${{ job.workflow_repository }}
WORKFLOW_SHA: ${{ job.workflow_sha }}
run: |
curl -fsSL --retry 3 -o "$RUNNER_TEMP/pre-commit.txt" \
"https://raw.githubusercontent.com/$WORKFLOW_REPOSITORY/$WORKFLOW_SHA/.github/requirements/pre-commit.txt"
python -m pip install --require-hashes -r "$RUNNER_TEMP/pre-commit.txt"
python -m pip freeze --local
- name: Cache pre-commit environments
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
run: pre-commit run --show-diff-on-failure --color=always --all-files