Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/rebase-prs-with-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Rebase PRs with develop

on:
push:
branches:
- develop

jobs:
sync-prs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Rebase all open non-Dependabots PRs with develop branch as base
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get all open PRs targeting develop, excluding Dependabot
prs=$(gh pr list --state open --base develop --limit 100 --json number,author --jq '.[] | select(.author.is_bot != true) | .number')

for pr in $prs; do
echo "Processing PR #$pr"
gh pr checkout $pr
git fetch origin develop

# Attempt rebase
if git rebase origin/develop; then
echo "PR #$pr rebased successfully. Pushing changes..."
git push --force-with-lease
else
echo "Conflict in PR #$pr. Rebase aborted."
git rebase --abort
# Optional: Notify author
gh pr comment $pr --body "⚠️ Automatic rebase failed due to conflicts. Please rebase manually."
fi
done
Loading