raulcd commented on code in PR #55484:
URL: https://github.com/apache/arrow/pull/55484#discussion_r4625669837
##########
.github/boring-cyborg.yml:
##########
@@ -59,16 +59,20 @@ labelPRBasedOnFilePath:
- "**/*.Rd"
verifyTitles:
- titleRegexp: '^(WIP:?\s*)?GH-[0-9]+|^MINOR: '
+ titleRegexp: '^GH-[0-9]+|^MINOR: '
alwaysUsePrTitle: true
validateEitherPrOrSingleCommitTitle: false
statusTitle: "PR Title"
successMessage: "PR title format is valid"
failureMessage: "Title must start with 'GH-<issue>: [Component]' or 'MINOR:
[Component]'"
insertIssueLinkInPrDescription:
- descriptionIssuePlaceholderRegexp: '^\* GitHub Issue: (.*)$'
+ descriptionIssuePlaceholderRegexp: '^\* GitHub Issue: (?!Refs )(.*)$'
matchers:
+ closedIssue:
+ targetBranchFilter: '^main$'
+ titleIssueIdRegexp: '^GH-([0-9]+)'
+ descriptionIssueLink: 'Closes #${1}'
Review Comment:
Do we want to test this config? I can do on my fork where I already
configured boring-cyborg app.
##########
dev/README.md:
##########
@@ -33,8 +33,40 @@ committer.
## How to Merge a Pull Request
-Please don't merge PRs using the GitHub Web interface. Instead, run
-the following command:
+Use the "Squash and merge" button of the GitHub Web interface. Before
+you merge, check that:
+
+* The pull request title is what you want as the commit title:
+ `GH-XXX: [Component] Title` or `MINOR: [Component] Title`. The
+ "PR Title" status of the Boring Cyborg app
+ (`.github/boring-cyborg.yml`) fails unless the title starts with
+ `GH-XXX` or `MINOR: ` but it doesn't block the merge.
+* The last line of the pull request description is
+ `* GitHub Issue: Closes #XXX`. The Boring Cyborg app writes it for a
+ pull request to `main` and GitHub closes the issue on merge because
+ of it. If the pull request fixes only a part of the issue, change
+ the line to `* GitHub Issue: Refs #XXX` before you merge: the issue
+ stays open. If the line doesn't say `Closes #XXX`, for example
+ because the app is down, change it or close the issue yourself.
+* The pull request description is what you want as the commit
+ message. Remove leftovers of the pull request template in the
+ merge dialog if needed. You should remove CI directives such as
+ `[skip ci]`: GitHub doesn't run the workflow below for a commit
+ with them.
+
+After the merge, the "Dev PR merged" GitHub Actions workflow reads
+`GH-XXX` from the commit title. If GitHub closed the issue, the
+workflow assigns it to the pull request author if it isn't assigned to
+anyone and sets its milestone. The existing issue milestone is
+retained: set it before merging if the pull request isn't targeted for
+the next major release. If the issue doesn't have a milestone, the next
+major release is used. This is only done for pull requests to `main`.
+
+### Merge script
+
+The merge script is still available for now. It additionally adds
Review Comment:
```suggestion
The merge script is still available for now but using the merge button is
encouraged. It additionally adds
```
##########
docs/source/developers/overview.rst:
##########
@@ -133,8 +133,13 @@ in the end. To make the review process smooth for
everyone, try to
When tests are passing and the pull request has been approved by the interested
parties, a `committer <https://arrow.apache.org/committers/>`_
-will merge the pull request. This is done with a
-**command-line utility that does a squash merge**.
+will merge the pull request. This is done with a **squash merge**.
+
+The ``* GitHub Issue:`` line at the end of the pull request description is
+filled in automatically from the pull request title. For a pull request to
+``main`` it says ``Closes #XXX`` and GitHub closes the issue when the pull
+request is merged. If your pull request fixes only a part of the issue, change
+the line to ``* GitHub Issue: Refs #XXX`` so that the issue stays open.
Review Comment:
Should we add this as a comment on the PR template?
##########
dev/release/post-04-website.sh:
##########
@@ -75,10 +75,34 @@ rough_n_development_months=$((
git_tag=apache-arrow-${version}
git_range=apache-arrow-${previous_version}..${git_tag}
-committers_command_line="git shortlog -sn --group=trailer:signed-off-by
${git_range}"
contributors_command_line="git shortlog -sn ${git_range}"
-committers=$(${committers_command_line})
+# Count the pull requests of the commits in ${git_range} by who merged
+# them. We ask GitHub because commits merged with the merge button
+# don't have "Signed-off-by:" trailers.
+list_committers() {
Review Comment:
This is extremely hard to follow.
As the script already requires archery and uses it to talk to GitHub
(`archery release changelog generate`), what about an `archery release
committers` command? Something like this in
`dev/archery/archery/release/cli.py`:
Have not tested the following, it's just claude:
```python
# needs `import collections`, `import re` and `from git import Repo`
@release.command('committers')
@click.argument('previous_version')
@click.argument('version')
@click.pass_obj
def release_committers(obj, previous_version, version):
"""Count the pull requests of a release by who merged them."""
repo = Repo(obj['repo'])
github_repo = obj['issue_tracker'].github_repo
commit_range = f"apache-arrow-{previous_version}..apache-arrow-{version}"
counts = collections.Counter()
for commit in repo.iter_commits(commit_range):
match = re.search(r" \(#(\d+)\)$", commit.summary)
if match is None:
# Release commits and direct pushes have no PR number.
continue
pr_number = int(match.group(1))
merged_by = github_repo.get_pull(pr_number).merged_by
if merged_by is None:
raise click.ClickException(f"#{pr_number} wasn't merged on
GitHub")
counts[merged_by.name or merged_by.login] += 1
for name, count in sorted(counts.items(), key=lambda c: (-c[1], c[0])):
click.echo(f"{count:6d}\t{name}")
```
and in `post-04-website.sh`:
```bash
committers=$(archery release committers ${previous_version} ${version})
```
If you prefer to keep it in bash, I think splitting it into named steps and
dropping the batching would already help a lot:
```bash
pr_numbers() {
git log --pretty=%s ${git_range} | sed -n -E 's/^.* \(#([0-9]+)\)$/\1/p'
}
merger() {
gh api "repos/apache/arrow/pulls/$1" --jq '.merged_by.login // error("not
merged")'
}
list_committers() {
local number
for number in $(pr_numbers); do
merger "${number}" || return 1
done | sort | uniq -c | sort -k1,1nr -k2
}
```
That one only shows logins, not names, getting names would need an extra
call per user.
--
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]