Skip to content

Commit 8a8f69a

Browse files
vjdhamaclaude
andcommitted
fix: resolve terraform-docs workflow git push failure
- Add conditional checkout ref for pull_request vs push events - Use github.head_ref for PRs to avoid detached HEAD state - Add push trigger for main branch commits - Include GITHUB_TOKEN for proper authentication This fixes the CI failure where terraform-docs couldn't push changes from detached HEAD state in PR contexts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent af43f75 commit 8a8f69a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/terraform-docs.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Terraform Docs
22

33
on:
4-
workflow_call:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
58

69
env:
710
TERRAFORM_DOCS_VERSION: v0.18.0
@@ -13,7 +16,8 @@ jobs:
1316
- name: Checkout repository
1417
uses: actions/checkout@v4
1518
with:
16-
ref: ${{ github.ref }}
19+
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
20+
token: ${{ secrets.GITHUB_TOKEN }}
1721

1822
- name: Render and Push terraform docs for main module
1923
uses: terraform-docs/gh-actions@main

0 commit comments

Comments
 (0)