Skip to content

Commit 5adee1b

Browse files
fix: update workflow for generating Terraform docs with improved permissions and checkout method
1 parent fbe0533 commit 5adee1b

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed
Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
name: Generate terraform docs
1+
name: Generate Terraform Docs
2+
23
on:
3-
pull_request:
4-
branches: [ main ]
4+
pull_request_target:
5+
branches: [main]
6+
types: [opened, synchronize, reopened, edited]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
statuses: write
12+
513
jobs:
614
docs:
15+
name: Generate Terraform Docs
716
runs-on: ubuntu-latest
17+
818
steps:
9-
- uses: actions/checkout@v3
10-
with:
11-
token: ${{ secrets.WRITE_PAT }}
12-
ref: ${{ github.event.pull_request.head.ref }}
19+
- name: Checkout base repo (safe)
20+
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.event.pull_request.base.ref }}
23+
token: ${{ secrets.WRITE_PAT }}
1324

14-
- name: Render terraform docs inside the README.md and push changes back to PR branch
15-
uses: terraform-docs/[email protected]
16-
with:
17-
working-dir: .
18-
output-file: README.md
19-
output-method: replace
20-
git-push: "true"
25+
- name: Generate terraform docs (from base only)
26+
uses: terraform-docs/[email protected]
27+
with:
28+
working-dir: .
29+
output-file: README.md
30+
output-method: replace
31+
git-push: "true"

0 commit comments

Comments
 (0)