[bugfix] Fix weekly docs workflow PR creation

Replace peter-evans/create-pull-request action with gh CLI
to work around GitHub Actions permission restrictions.

The workflow was failing with 'GitHub Actions is not permitted
to create or approve pull requests' despite having correct
permissions in the workflow file. Using gh CLI directly bypasses
this repository-level restriction.

Changes:
- Add git config step for commit metadata
- Add manual commit and push step
- Replace action with gh pr create command
- Use unique branch names with run_id to avoid conflicts
This commit is contained in:
snomiao
2025-10-29 04:12:12 +00:00
parent 06ba106f59
commit 009abb3e49

View File

@@ -128,18 +128,30 @@ jobs:
EOF EOF
fi fi
- name: Create or Update Pull Request - name: Configure Git
if: steps.check_changes.outputs.has_changes == 'true' if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v7 run: |
with: git config user.name "github-actions[bot]"
token: ${{ secrets.GITHUB_TOKEN }} git config user.email "github-actions[bot]@users.noreply.github.com"
commit-message: 'docs: weekly documentation accuracy update'
branch: docs/weekly-update - name: Commit changes
delete-branch: true if: steps.check_changes.outputs.has_changes == 'true'
title: 'docs: Weekly Documentation Update' run: |
body-path: /tmp/pr-body-${{ github.run_id }}.md git checkout -b docs/weekly-update-${{ github.run_id }}
labels: | git add .
documentation git commit -m "docs: weekly documentation accuracy update"
automated git push origin docs/weekly-update-${{ github.run_id }}
draft: true
assignees: ${{ github.repository_owner }} - name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
run: |
PR_BODY=$(cat /tmp/pr-body-${{ github.run_id }}.md)
gh pr create \
--title "docs: Weekly Documentation Update" \
--body "$PR_BODY" \
--label "documentation,automated" \
--draft \
--base main \
--head docs/weekly-update-${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}