zhengruifeng opened a new pull request, #56007:
URL: https://github.com/apache/spark/pull/56007
### What changes were proposed in this pull request?
When `dev/merge_spark_pr.py` merges a PR whose target branch is not the
repository's default (e.g. backport PRs against `branch-X.Y`), explicitly close
the PR through the GitHub REST API after the push succeeds. Specifically:
- Add a small `close_pr(pr_num)` helper that issues an authenticated `PATCH
/pulls/{n}` with `{"state": "closed"}`.
- Plumb a `default_branch` parameter into `merge_pr()`. `main()` fetches it
via `GET /repos/apache/spark` once and passes it in.
- After a successful `git push` in `merge_pr()`, if `target_ref !=
default_branch`, call `close_pr(pr_num)`.
### Why are the changes needed?
The squash-merge commit message already contains `Closes #N from ...`, which
GitHub treats as a closing keyword. However, GitHub honors closing keywords
**only when the commit lands on the repository's default branch**. Backport PRs
that target `branch-X.Y` therefore got merged successfully but stayed open on
GitHub, and the committer had to close them manually. #56004 was a recent
example.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Compile-checked with `python3 -m py_compile dev/merge_spark_pr.py` and the
existing doctests still pass via `python3 -m doctest dev/merge_spark_pr.py`.
End-to-end merge behavior will be validated the next time a committer runs the
script on a backport PR.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]