-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (40 loc) · 1.31 KB
/
pre-commit.yaml
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
47
48
49
50
51
name: Run pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: setup setup-python
uses: actions/setup-python@v5
- name: Install tflint
env:
TFLINT_VERSION: 0.48.0
INSTALL_PATH: /usr/local/bin
run: |
set -euo pipefail
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
arch="amd64"
fi
filename="tflint_${platform}_${arch}.zip"
curl -s -LO "https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/${filename}"
unzip $filename -d "${INSTALL_PATH}"
- name: Install Trivy
env:
TRIVY_VERSION: 0.49.0
run: |
set -euo pipefail
curl --retry 3 --retry-delay 5 -sSL "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" | tar xz -C /usr/local/bin --overwrite
- name: Install pre-commit framework
env:
PRE_COMMIT_VERSION: 3.4.0
run: |
pip install pre-commit==${PRE_COMMIT_VERSION}
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=auto