feat: Auto-rebase open PRs when master is updated (#983) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Rebase all open PRs when master is updated | |
| # This keeps PRs up-to-date automatically | |
| name: Rebase Open PRs | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| rebase-open-prs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Rebase all open PRs | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| gh pr list --state open --json number,author,isDraft --jq '.[] | select(.isDraft == false) | "\(.number) \(.author.login)"' | while read pr author; do | |
| if [ "$author" = "dependabot[bot]" ]; then | |
| echo "Requesting rebase for Dependabot PR #$pr" | |
| gh pr comment "$pr" --body "@dependabot rebase" | |
| else | |
| echo "Updating branch for PR #$pr" | |
| gh pr update-branch --rebase "$pr" || true | |
| fi | |
| done |