Repository navigation
GH-55475: [Dev] Use merge button instead of merge script - #55484
Conversation
4b8ed1c to
c34e788
Compare
|
|
a681b72 to
8af40b8
Compare
96ffdb2 to
3a6799e
Compare
3a6799e to
65e2f5a
Compare
65e2f5a to
36ac2dd
Compare
| # 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| exit 0 | ||
| fi | ||
| issue_number=${BASH_REMATCH[1]} | ||
| issue=$(gh api "repos/${GH_REPO}/issues/${issue_number}") |
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
I think that we don't need issue assignees. We don't use them and we can compute them by PR author.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| <!-- | ||
| 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) |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Indeed, moved the note into the (...) placeholder in 46e2820 so Boring Cyborg replaces it automatically.
| # 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 |
There was a problem hiding this comment.
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:
- Collect
GH-XXXfrom the commit titles inapache-arrow-${PREVIOUS_MAJOR_VERSION}..main - Find closed issues without milestone in them
- 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
- If the commit is included in
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 curatealready 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.
There was a problem hiding this comment.
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.
|
@kou thank you for the review! Any further comments or shall we merge? |
kou
left a comment
There was a problem hiding this comment.
+1
Could you add the following to .asf.yaml?
https://github.com/apache/arrow-js/blob/5aa020540217b1aef9571cd3c9473627cd909e2f/.asf.yaml#L27-L31
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Rationale for this change
Committers currently need a GitHub personal access token and
dev/merge_arrow_pr.pyto 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?
.github/boring-cyborg.yml,.github/pull_request_template.md): For PRs targetingmain, Boring Cyborg populates* GitHub Issue: Closes #XXXso GitHub natively closes and links the issue on merge. ChangingClosestoRefskeeps the issue open for partial fixes and is preserved by the bot. The non-blocking "PR Title" check no longer acceptsWIP:prefixes, and the template guidance lives inside the placeholder so nothing leaks into squash commit messages.dev/archery/archery/release/,.github/workflows/dev_update_milestones.yml): Addsarchery release update-milestonesand runs it every 6 hours (plusworkflow_dispatch) to set milestones on closed, unmilestoned issues referenced byGH-XXXcommits since the last major release tag. Milestones are chosen from branch membership (maint-X.0.0vs. the next open major release), existing milestones are never overwritten, and missed cases (such as[skip ci]commits or manually closed issues) recover automatically.dev/archery/archery/release/,dev/archery/setup.py,dev/release/post-04-website.sh): Addsarchery release committersto count merged PRs via GitHub GraphQL instead ofSigned-off-by:commit trailers, and updatespost-04-website.shto loadGH_TOKENviautils-env.shand use it.dev/README.md,docs/source/developers/): Documents merging with the GitHub button, theCloses/Refsconvention, the scheduled milestone workflow, and runningarchery release update-milestonesbefore curating a release.dev/merge_arrow_pr.pyremains unchanged and usable during the transition.Are these changes tested?
dev/archery/archery/release/tests/test_release.pycoveringcount_committersandupdate_milestones(maintenance branch cuts, cherry-picks, partial-to-closing spans,NOT_PLANNED/open/existing-milestone/PR/NOT_FOUNDhandling,dry_run, and missing next major milestone).apache/arrow(archery release update-milestones --dry-runandarchery release committers).dev/archerytests, 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:
Reviewed before submission by: