PR Update Action
Maintainers usually reply within 3 days
@KumoLiu is already working on this.
Since Sep 29, 2026.
Assessment
This issue has not been assessed yet.
Description
Is your feature request related to a problem? Please describe.
When PRs are approved they need their branches to be manually kept up to date with the state of dev, this is a bottleneck issue in getting more PRs through because we can't automate a pipeline. The solution is to use an action to update the PRs when dev gets pushed. This should update only the oldest PR which is both approved and has automerge enabled. These two properties together can thus be used by maintainers to signify a PR is ready to be eventually merged, there shouldn't every be many of these so it's not going to create ordering confusion, but will stop working if a PR is help up with test fails. This is an alternative to merge queues.
Describe the solution you'd like
The action below is derived from this test which automates this process:
name: Auto-Update PRs
on:
push:
branches:
- main # Change to your primary target branch (e.g., dev)
workflow_dispatch: # Allows manual triggering if needed
permissions:
contents: write
pull-requests: write
jobs:
update-prs:
runs-on: ubuntu-latest
steps:
- name: Checkout target branch
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetches all history so branches can be merged locally
- name: Update the oldest PR which is approved and automerging-enabled
env:
GH_TOKEN: ${{ secrets.PAT_UPDATE_TOKEN }}
run: |
# Find all open PRs targeting this branch which are open and approved
PR_DATA=$(gh pr list --state open --search 'review:approved' --base ${{ github.ref_name }} --json number,reviewDecision,autoMergeRequest)
echo '================================'
echo "PR_DATA:"
echo $PR_DATA
echo '================================'
# select the oldest open approved PR with automerge enabled
OLDEST_APPROVED=$(echo $PR_DATA | jq -r '.[] | select(.reviewDecision == "APPROVED") | select(.autoMergeRequest != null) | "\(.number)"'|head -n 1)
if [ -z "$OLDEST_APPROVED" ]
then
echo "No approved PRs to update."
else
echo "Updating PR $OLDEST_APPROVED ..."
gh pr update-branch "$OLDEST_APPROVED" || echo "Failed to update PR #$OLDEST_APPROVED (merge conflicts?)."
fi
This critically relies on a personal access token (PAT) being set to PAT_UPDATE_TOKEN which has read/write permissions for Contents and PullRequests (and maybe Actions as well). This won't work with GITHUB_TOKEN since approval will be required to run the actions in each updated PR and so obviate the point of the exercise.
The possible plan then is to PR this action in and setup a PAT to provide the permissions, though whose PAT is the question to answer. This stems from a recent change to Github security rules.
- Dominant language
- Python
- Stars
- 8.7k
- Forks
- 1.6k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 17
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Project-MONAI/MONAI
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Project-MONAI/MONAI#9135 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Project-MONAI/MONAI#9068 · 2 comments ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Project-MONAI/MONAI#9046 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Project-MONAI/MONAI#9026 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
Project-MONAI/MONAI#9144 ·
Maintainers usually reply within 3 days
All issues in Project-MONAI/MONAI
Similar issues
-
upstream update
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conan-io/conan-center-index#31098 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
john-kurkowski/tldextract#382 ·
-
comp/tools duplicate P2 sweeper:risk-compatibility tool/mcp type/bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NousResearch/hermes-agent#132042 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepset-ai/haystack#13092 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
feder-cr/invisible_playwright_mcp#1408 ·
Maintainers usually reply within 1 day