-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.4 KB
/
validate.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
name: Format and validate
on:
push:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Setup terraform-docs
run: |
sudo apt-get update
sudo apt-get install -y curl
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-Linux-amd64.tar.gz
tar -xzf terraform-docs.tar.gz
rm terraform-docs.tar.gz
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/terraform-docs
- name: Grant execute permissions
run: chmod +x *
working-directory: ./devops/scripts
- name: Format and generate terraform-docs
run: ./format.sh
working-directory: ./devops/scripts
- name: Remove execute permissions
run: chmod -x *
working-directory: ./devops/scripts
- name: Check git diffs
run: |
# Post-process to Revert Unwanted Changes
git checkout -- LICENSE README.md
status=$(git status --porcelain=v1)
echo "Git status output: $status"
if [[ -n "$status" ]]; then
git diff
exit 1
fi
working-directory: ./