-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (53 loc) · 1.56 KB
/
pre-commit-and-tests.yml
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
52
53
54
55
56
57
58
name: pre-commit
env:
AWS_REGION: af-south-1
AWS_ROLE_ARN: arn:aws:iam::353444730604:role/cat-genrl-prd-infra-github-workflows
on:
workflow_dispatch:
pull_request:
branches:
- main
- master
- develop
permissions:
id-token: write
contents: read
defaults:
# Set shell for steps inside containers (default=sh)
run:
shell: bash
jobs:
#--------------------------------------------------------------
# PRE-COMMIT
#--------------------------------------------------------------
pre_commit:
name: 💍 pre-commit
# For public repos use runs-on: ubuntu-latest
# For private repos use runs-on: self-hosted
runs-on: ubuntu-latest
container: bjorncloudandthings/terraform-aws-github:latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: hashicorp/setup-terraform@v2
- name: Install requirements
run: |
python -m venv .venv
source .venv/bin/activate
if [ -f requirements.txt ]; then
pip install -r requirements.txt
else
pip install pre-commit
pip install checkov
fi
- name: Run
run: |
source .venv/bin/activate
pre-commit install
if [[ "${{ env.GITHUB_REPOSITORY}}" == "cloudandthings/terraform-aws-template" ]]; then
export SKIP=no-vanilla-readme
fi
pre-commit run --all-files --show-diff-on-failure
- name: cat pre-commit log
if: failure()
run: cat ~/.cache/pre-commit/pre-commit.log