Skip to content

Commit cf40d24

Browse files
dogmarclaude
andcommitted
ci: switch sync-readme to check-only mode
Instead of auto-pushing a fix commit (which doesn't re-trigger required checks due to GITHUB_TOKEN anti-loop policy), the workflow now just fails if the README is out of sync. Run `bash scripts/sync-readme.sh` locally and push to fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b98aa20 commit cf40d24

1 file changed

Lines changed: 5 additions & 30 deletions

File tree

‎.github/workflows/sync-readme.yml‎

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414

1515
permissions:
16-
contents: write
16+
contents: read
1717

1818
jobs:
1919
sync:
@@ -22,7 +22,6 @@ jobs:
2222
- uses: actions/checkout@v4
2323
with:
2424
ref: ${{ github.head_ref }}
25-
token: ${{ secrets.GITHUB_TOKEN }}
2625

2726
- uses: voidzero-dev/setup-vp@v1
2827
with:
@@ -34,34 +33,10 @@ jobs:
3433
- name: Run sync script
3534
run: vp run sync-readme
3635

37-
- name: Commit and push if changed
38-
id: sync
36+
- name: Fail if README is out of sync
3937
run: |
40-
if git diff --quiet README.md; then
41-
echo "pushed=false" >> "$GITHUB_OUTPUT"
42-
exit 0
43-
fi
44-
git config user.name "github-actions[bot]"
45-
git config user.email "github-actions[bot]@users.noreply.github.com"
46-
git add README.md
47-
git commit -m "docs: sync README code blocks"
48-
if ! git push; then
49-
echo "::error::README is out of sync and could not push fix to branch"
38+
if ! git diff --quiet README.md; then
39+
echo "::error::README is out of sync. Run 'bash scripts/sync-readme.sh' locally and push."
40+
git diff README.md
5041
exit 1
5142
fi
52-
echo "pushed=true" >> "$GITHUB_OUTPUT"
53-
54-
# GitHub's anti-loop policy: pushes made with the default GITHUB_TOKEN
55-
# don't fire `pull_request`/`push` events, so the synced commit would
56-
# land on the PR with no CI run. Re-dispatch CI manually so the new HEAD
57-
# gets validated. (For a "proper" fix that fires the synchronize event,
58-
# plumb a PAT/App token through the checkout step's `token:` input.)
59-
- name: Re-trigger CI on synced commit
60-
if: steps.sync.outputs.pushed == 'true'
61-
env:
62-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
BRANCH: ${{ github.head_ref }}
64-
run: |
65-
gh workflow run ci.yml --ref "$BRANCH"
66-
gh workflow run sync-readme.yml --ref "$BRANCH"
67-
gh workflow run pr-title.yml --ref "$BRANCH"

0 commit comments

Comments
 (0)