-
Notifications
You must be signed in to change notification settings - Fork 24
38 lines (38 loc) · 1.19 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
name: precommit
on:
pull_request:
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Create virtual environment
run: python3 -m venv venv && source venv/bin/activate
- name: Install pre-commit and checkov
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pre-commit==3.5.0 checkov==2.5.10
- name: install terraform-docs
run: |
curl -sSLo ./terraform-docs.tar.gz https://terraform-docs.io/dl/v0.16.0/terraform-docs-v0.16.0-$(uname)-amd64.tar.gz
tar -xzf terraform-docs.tar.gz
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/
- name: Cache packages
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files