From 009abb3e49fcfcde783b61a9ffd517e95554fc30 Mon Sep 17 00:00:00 2001 From: snomiao Date: Wed, 29 Oct 2025 04:12:12 +0000 Subject: [PATCH] [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 --- .github/workflows/weekly-docs-check.yaml | 40 +++++++++++++++--------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/weekly-docs-check.yaml b/.github/workflows/weekly-docs-check.yaml index ce72c3e7e..515df5ab9 100644 --- a/.github/workflows/weekly-docs-check.yaml +++ b/.github/workflows/weekly-docs-check.yaml @@ -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 }}