[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
fi
- name: Create or Update Pull Request
- name: Configure Git
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: weekly documentation accuracy update'
branch: docs/weekly-update
delete-branch: true
title: 'docs: Weekly Documentation Update'
body-path: /tmp/pr-body-${{ github.run_id }}.md
labels: |
documentation
automated
draft: true
assignees: ${{ github.repository_owner }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git checkout -b docs/weekly-update-${{ github.run_id }}
git add .
git commit -m "docs: weekly documentation accuracy update"
git push origin docs/weekly-update-${{ github.run_id }}
- 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 }}