Skip to content

Add merge workflow#22120

Draft
iluuu1994 wants to merge 10 commits into
php:masterfrom
iluuu1994:merge-workflow
Draft

Add merge workflow#22120
iluuu1994 wants to merge 10 commits into
php:masterfrom
iluuu1994:merge-workflow

Conversation

@iluuu1994
Copy link
Copy Markdown
Member

@iluuu1994 iluuu1994 commented May 22, 2026

TODOs:

  • NEWS entry. Maybe the entry can be added to the PR description and then added to the commit by the workflow.
  • Sign commits. I think the bot will need its own account.
  • Add Signed-off-by from the person adding the label, and potentially from approved PR reviews.
  • Add Co-Authored-By for any other commiter.
  • Potentially add some guardrails, e.g. adding a limit on merged commits if the target is wrong.

Feedback is appreciated. I know some people were skeptical of this approach (@TimWolla, @shivammathur), but I think it's worth trying out. @asgrim expressed interest in this, after seeing how many steps the merge process involves.

Simple test on my fork:

image

Copy link
Copy Markdown
Member

@shivammathur shivammathur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial thoughts

Comment thread .github/workflows/merge_pr.yml
fetch-depth: 0
filter: blob:none
ref: ${{ github.event.pull_request.base.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that merging with GITHUB_TOKEN triggers CI for merged branches, This might need an app token.

Comment on lines +4 to +5
pull_request_target:
types: [labeled]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using pull_request_target should be avoided. I would suggest using workflow_dispatch that gets triggered by a separate small workflow that runs on issues: labeled, validates the label/actor/PR, then calls the dispatch workflow.

Comment thread .github/scripts/merge_pr.php
Comment thread .github/scripts/merge_pr.php Outdated
Comment thread .github/scripts/merge_pr.php Outdated
Comment on lines +45 to +47
PR_FIRST_SHA: $(git log --reverse --format=%H ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | head -n1)
PR_SHA: ${{ github.event.pull_request.head.sha }}
PR_REF: ${{ github.event.pull_request.head.ref }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a check to stop this workflow before pushing changes if the PR_SHA does not match the PR head as it changed between the label event and the workflow merging and pushing. This can happen when the nightly workflow is running and other workflows runs are delayed.

Comment thread .github/workflows/merge_pr.yml
iluuu1994 added 8 commits May 23, 2026 14:19
Merging should be fully sequential.
- When updating the PR branch fails due to remote rejection, continue. This is
  due to the unticked "Allow edits by maintainers" checkbox.
- Attempt to revert the PR branch if the atomic release branch push failed.
[remote rejected] is not reliably there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants