forked from philips-labs/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 2.2 KB
/
update-docs.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
name: Update docs
on:
push:
paths:
- "**/*.tf"
- "**/*.md"
- ".github/workflows/update-docs.yml"
permissions:
contents: write
pull-requests: write
jobs:
docs:
# update docs after merge back to develop
name: Auto update terraform docs
runs-on: ubuntu-latest
steps:
- name: Get installation token
uses: philips-software/app-token-action@a37926571e4cec6f219e06727136efdd073d8657 # ratchet:philips-software/app-token-action@v1.1.2
id: token
with:
app_id: ${{ secrets.FOREST_RELEASER_APP_ID }}
app_base64_private_key: ${{ secrets.FOREST_RELEASER_APP_PRIVATE_KEY_BASE64 }}
auth_type: installation
# We use the app for branches in this this repo to ensure PR chekcs are kept in place.
- if: github.event_name == 'push' && github.repository_owner == 'philips-labs' && github.ref != 'refs/heads/main'
name: Checkout with App Token
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
- if: (github.event_name == 'push' && github.repository_owner != 'philips-labs') || github.ref == 'refs/heads/main'
name: Checkout with GITHUB Action token
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4
- name: Generate TF docs
uses: terraform-docs/gh-actions@89278fb4a14410bf46fcfbbfd6c96e962ae7b13c # ratchet:terraform-docs/gh-actions@v1.2.1
with:
find-dir: .
git-commit-message: "docs: auto update terraform docs"
git-push: ${{ github.ref != 'refs/heads/main' }}
- name: Create Pull Request (main branch only)
if: github.ref == 'refs/heads/main'
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/create-pull-request@v5.0.2
with:
token: ${{ steps.token.outputs.token || secrets.GITHUB_TOKEN }}
commit-message: "Update Terraform docs"
title: "docs: Update Terraform docs"
branch: ${{ github.event.pull_request.base.ref }}-update-docs
base: ${{ github.event.pull_request.base.ref }}