-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.27 KB
/
terraform-update-documentation.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
name: "Automatically update terraform markdown files"
on:
pull_request_target:
paths: "templates/terraform/**"
pull_request:
paths: "templates/terraform/**"
env:
TERRAFORM_PATH: "templates/terraform"
jobs:
update-lockfiles:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Checkout ${{ github.head_ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Setup git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Generate TF Docs
uses: terraform-docs/[email protected]
with:
find-dir: ${{ env.TERRAFORM_PATH }}
output-file: USAGE.md
- name: Update branch
run: |
git status
if output=$(git status --porcelain) && [ -z "$output" ]; then
# Working directory clean - do nothing
echo Working directory clean
exit 0
else
# Uncommitted changes
echo Add and commit changes
git commit -a -m "Update TF markdown"
git push
fi