diff --git a/.github/workflows/auto-update-pr-branches.yaml b/.github/workflows/auto-update-pr-branches.yaml index 1b9535c..4528c32 100644 --- a/.github/workflows/auto-update-pr-branches.yaml +++ b/.github/workflows/auto-update-pr-branches.yaml @@ -16,35 +16,19 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'trebent/envparser' steps: - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + - name: Generate Jeeves app token + id: jeeves-token + uses: actions/create-github-app-token@v1 with: - client-id: ${{ secrets.JEEVES_APP_ID }} + app-id: ${{ secrets.JEEVES_APP_ID }} private-key: ${{ secrets.JEEVES_APP_PRIVATE_KEY }} - - name: Update out-of-date PR branches env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} + GH_TOKEN: ${{ steps.jeeves-token.outputs.token }} run: | - gh pr list --repo "${{ github.repository }}" --base main --state open --json number,author \ - --jq '.[] | "\(.number) \(.author.login)"' | \ - while IFS=' ' read -r pr author; do - echo "Checking PR #$pr (author: $author)..." - if [ "$author" = "app/dependabot" ]; then - # Trigger Dependabot to rebase its own branch rather than pushing directly with - # the Jeeves bot token. If Jeeves pushes, dependabot/fetch-metadata fails with - # "PR is not from Dependabot" on the resulting synchronize event, which prevents - # Jeeves from re-approving and re-enabling auto-merge on that PR. - merge_state=$(gh pr view "$pr" --repo "${{ github.repository }}" \ - --json mergeStateStatus --jq '.mergeStateStatus' 2>/dev/null || echo "ERROR") - if [ "$merge_state" = "BEHIND" ]; then - echo "PR #$pr is behind main, triggering Dependabot rebase" - gh pr comment --repo "${{ github.repository }}" "$pr" --body "@dependabot rebase" || true - else - echo "PR #$pr merge state is '$merge_state', no update needed" - fi - else - gh pr update-branch --rebase --repo "${{ github.repository }}" "$pr" || true - fi + gh pr list --repo "${{ github.repository }}" --base main --state open --json number \ + --jq '.[].number' | \ + while read -r pr; do + echo "Updating PR #$pr..." + gh pr update-branch --rebase --repo "${{ github.repository }}" "$pr" || true done