Skip to content

GH-55475: [Dev] Use merge button instead of merge script - #55484

Merged
rok merged 18 commits into
apache:mainfrom
rok:gh-55475-merge-button
Nov 27, 2026
Merged

rok merged 18 commits into
apache:mainfrom
rok:gh-55475-merge-button

Conversation

@rok

@rok rok commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Committers currently need a GitHub personal access token and dev/merge_arrow_pr.py to merge pull requests. This change lets committers use GitHub's "Squash and merge" button directly while preserving automatic issue closure, milestone tracking, and release-note committer counts.

What changes are included in this PR?

  • Automatic issue closure with partial-fix opt-out (.github/boring-cyborg.yml, .github/pull_request_template.md): For PRs targeting main, Boring Cyborg populates * GitHub Issue: Closes #XXX so GitHub natively closes and links the issue on merge. Changing Closes to Refs keeps the issue open for partial fixes and is preserved by the bot. The non-blocking "PR Title" check no longer accepts WIP: prefixes, and the template guidance lives inside the placeholder so nothing leaks into squash commit messages.
  • Self-healing milestone assignment from the commit graph (dev/archery/archery/release/, .github/workflows/dev_update_milestones.yml): Adds archery release update-milestones and runs it every 6 hours (plus workflow_dispatch) to set milestones on closed, unmilestoned issues referenced by GH-XXX commits since the last major release tag. Milestones are chosen from branch membership (maint-X.0.0 vs. the next open major release), existing milestones are never overwritten, and missed cases (such as [skip ci] commits or manually closed issues) recover automatically.
  • GitHub-based patch committer counting (dev/archery/archery/release/, dev/archery/setup.py, dev/release/post-04-website.sh): Adds archery release committers to count merged PRs via GitHub GraphQL instead of Signed-off-by: commit trailers, and updates post-04-website.sh to load GH_TOKEN via utils-env.sh and use it.
  • Developer and release documentation (dev/README.md, docs/source/developers/): Documents merging with the GitHub button, the Closes/Refs convention, the scheduled milestone workflow, and running archery release update-milestones before curating a release. dev/merge_arrow_pr.py remains unchanged and usable during the transition.

Are these changes tested?

  • Added unit tests in dev/archery/archery/release/tests/test_release.py covering count_committers and update_milestones (maintenance branch cuts, cherry-picks, partial-to-closing spans, NOT_PLANNED/open/existing-milestone/PR/NOT_FOUND handling, dry_run, and missing next major milestone).
  • Verified both new Archery commands live against apache/arrow (archery release update-milestones --dry-run and archery release committers).
  • Verified dev/archery tests, linters, docs build, and release tests in CI.

Are there any user-facing changes?

No.

Was AI used for this PR?

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@rok rok changed the title GH-55475: [Dev] Use merge button instead of merge script WIP: GH-55475: [Dev] Use merge button instead of merge script Nov 10, 2026
@rok rok changed the title WIP: GH-55475: [Dev] Use merge button instead of merge script WIP: GH-55475: [Dev] Merge pull requests with a comment instead of the merge script Nov 10, 2026
@rok rok changed the title WIP: GH-55475: [Dev] Merge pull requests with a comment instead of the merge script WIP: GH-55475: [Dev] Use merge button instead of merge script Nov 10, 2026
@rok
rok force-pushed the gh-55475-merge-button branch from 4b8ed1c to c34e788 Compare November 10, 2026 21:02
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55475 has been automatically assigned in GitHub to PR creator.

@rok
rok force-pushed the gh-55475-merge-button branch 5 times, most recently from a681b72 to 8af40b8 Compare November 10, 2026 22:43
@rok rok changed the title WIP: GH-55475: [Dev] Use merge button instead of merge script GH-55475: [Dev] Use merge button instead of merge script Nov 10, 2026
@rok
rok force-pushed the gh-55475-merge-button branch 2 times, most recently from 96ffdb2 to 3a6799e Compare November 10, 2026 23:14
@rok
rok marked this pull request as ready for review November 10, 2026 23:24
Copilot AI balanced review requested due to automatic review settings November 10, 2026 23:24

This comment was marked as outdated.

@rok
rok force-pushed the gh-55475-merge-button branch from 3a6799e to 65e2f5a Compare November 10, 2026 23:41
Copilot AI balanced review requested due to automatic review settings November 10, 2026 23:41

This comment was marked as resolved.

@rok
rok force-pushed the gh-55475-merge-button branch from 65e2f5a to 36ac2dd Compare November 11, 2026 09:17
Copilot AI balanced review requested due to automatic review settings November 11, 2026 09:17

This comment was marked as resolved.

@raulcd raulcd left a comment

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.

in general looks good to me. @kou what do you think?

Comment thread .github/workflows/dev_pr_merged.yml Outdated
# because of "* GitHub Issue: Closes #XXX" in the pull request
# description. This sets what GitHub doesn't set: the assignee
# and the milestone of the issue.
- name: Update issue

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.

Maybe a minor nit for easier debugging could be to split this Update issue into ~3 steps:

  • Get PR and issue
  • Assign issue
  • Assign milestone

So it's easier to see where it failed / debug steps etc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Split into three steps in 20eb0e7: "Get issue", "Assign issue" and "Set milestone". The first step is "Get issue" and not "Get PR and issue" because the workflow reads the issue number from the commit title and does not fetch the pull request. The conditions are now if: of the steps, so a step that has nothing to do is shown as skipped.

Copilot AI balanced review requested due to automatic review settings November 19, 2026 17:24

This comment was marked as low quality.

Comment thread .github/workflows/dev_pr_merged.yml Outdated
exit 0
fi
issue_number=${BASH_REMATCH[1]}
issue=$(gh api "repos/${GH_REPO}/issues/${issue_number}")

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.

Can we use gh issue view?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed that gh issue view would have been cleaner than raw gh api, though this workflow was replaced by the scheduled archery release update-milestones job in e15f6cc.

Comment thread .github/workflows/dev_pr_merged.yml Outdated
Comment on lines +73 to +85
# Assign the issue to the commit author, who is the pull request
# author for a squash merge, if it isn't assigned to anyone.
# GitHub ignores this silently if the author can't be assigned.
- name: Assign issue
if: >-
steps.issue.outputs.n_assignees == '0' &&
github.event.head_commit.author.username
env:
AUTHOR: ${{ github.event.head_commit.author.username }}
ISSUE_NUMBER: ${{ steps.issue.outputs.number }}
run: |
gh api "repos/${GH_REPO}/issues/${ISSUE_NUMBER}/assignees" \
-f "assignees[]=${AUTHOR}" > /dev/null

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.

I think that we don't need issue assignees. We don't use them and we can compute them by PR author.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dropped issue assignment in e15f6cc since Closes #XXX links the resolving PR natively on the issue. I'm not sure about this though. If others like it let's go ahead.

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.

@raulcd FYI: We don't need issue assignees, right?

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.

For the release we don't. We currently extract them from the signed-off-by trail. This PR changes how we compute them so assigning issues seems it was merely cosmetic.

Comment thread .github/pull_request_template.md Outdated
Comment on lines 37 to 43
<!--
The line below is filled in automatically from the PR title. For a PR to main
it says "Closes #XXX" and GitHub closes the issue when the PR is merged. If
your PR fixes only a part of the issue, change "Closes" to "Refs" so that the
issue stays open.
-->
* GitHub Issue: (filled in automatically from the PR title)

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.

Can we use the (...) part instead of the <!-- ... --> part for this note? I think that most contributors will not remove the <!-- ... --> part and most merged messages will include the <!-- ... --> part...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Indeed, moved the note into the (...) placeholder in 46e2820 so Boring Cyborg replaces it automatically.

Comment thread .github/workflows/dev_pr_merged.yml Outdated
Comment on lines +86 to +110
# Keep the milestone of the issue. If the issue doesn't have a
# milestone, use the next major release that doesn't have a
# maintenance branch yet like dev/merge_arrow_pr.py does.
- name: Set milestone
if: steps.issue.outputs.has_milestone == 'false'
env:
ISSUE_NUMBER: ${{ steps.issue.outputs.number }}
run: |
set -euo pipefail

maintenance_versions=$(
gh api --paginate "repos/${GH_REPO}/git/matching-refs/heads/maint-" \
--jq '.[].ref | ltrimstr("refs/heads/maint-")')
major_versions=$(
gh api --paginate "repos/${GH_REPO}/milestones?per_page=100" \
--jq '.[] | select(.title | test("^[0-9]+\\.0\\.0$")) | "\(.title):\(.number)"' |
sort -V)
for major_version in ${major_versions}; do
if ! grep -qxF "${major_version%:*}" <<< "${maintenance_versions}"; then
echo "Milestone: ${major_version%:*}"
gh api -X PATCH "repos/${GH_REPO}/issues/${ISSUE_NUMBER}" \
-F "milestone=${major_version#*:}" > /dev/null
break
fi
done

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.

How about setting milestones by a scheduled archery job instead of the push triggered dev_pr_merged.yml?

For example, we can add archery release update-milestones (or archery release curate --fix) and run it by schedule and workflow_dispatch:

  1. Collect GH-XXX from the commit titles in apache-arrow-${PREVIOUS_MAJOR_VERSION}..main
  2. Find closed issues without milestone in them
  3. Set a milestone based on where the commit is:
    • If the commit is included in maint-X.0.x: X.0.0
    • Otherwise: The next major version that doesn't have its maintenance branch yet

Benefits:

  • We don't need to care about the race between our workflow and GitHub's auto close by Closes #XXX. The current workflow skips the issue when it's still open.
  • We can recover missed cases automatically: merged with [skip ci], Boring Cyborg was down and the issue was closed manually later, merged by the merge script and so on. The job is idempotent.
  • We can use the commit graph instead of guessing "the next major version" at merge time. If a maintenance branch is created after a merge, the current approach in a scheduled job would choose a wrong version but the commit graph doesn't.
  • We can implement and test the logic in Python. archery release curate already compares commits and milestones.

We don't change existing milestones. So if a committer wants to backport a fix, the committer can still set the milestone for the maintenance release before or after merging. The release manager can also run the job manually by workflow_dispatch before archery release curate/archery release cherry-pick.

@rok rok Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interesting idea. I replaced dev_pr_merged.yml with archery release update-milestones and .github/workflows/dev_update_milestones.yml (every 6 hours + workflow_dispatch) in e15f6cc.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 11:50

This comment was marked as low quality.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 12:04

This comment was marked as low quality.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 12:33

This comment was marked as low quality.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 13:27

This comment was marked as resolved.

This comment was marked as resolved.

@rok

rok commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@kou thank you for the review! Any further comments or shall we merge?

@kou kou left a comment

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.

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

This comment was marked as low quality.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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.

6 participants