Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate labels from merged pull requests #97

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

masaru-iritani
Copy link

@onk @motemen

This is a revival of #56 originally done by @ohbarye, who kindly allowed me to take over the work. The only change I made is changing the config name from aggregate_labels to aggregate-labels because git config returns an error when the config name contains underscores.

Issue

Closes #54

Changes

As described in #54, this change adds a feature to add labels assigned to merged pull requests.

  • Add pr-release.aggregate-labels config (or GIT_RELEASE_PR_AGGREGATE_LABELS environment variable). It accepts a boolean-ish value, "true" or anything. Only when it is "true", git-release-pr aggregates labels from merged pull requests.
  • When pr-release.labels is given at the same time, merge them. For example, when pr-release.labels=foo,bar and aggregated labels are "baz", labels would be ["foo", "bar", "baz"].

Testing

Confirmed git-pr-release with this change created a release pull request with a label assigned to a merged pull request.

> DEBUG=true GIT_PR_RELEASE_AGGREGATE_LABELS=true GIT_PR_RELEASE_BRANCH_PRODUCTION=production GIT_PR_RELEASE_BRANCH_STAGING=staging bundle exec ruby ./exe/git-pr-release
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Executing `git config remote.origin.url`
Executing `git config -f .git-pr-release pr-release.template`
Executing `git config pr-release.template`
Executing `git config -f .git-pr-release pr-release.labels`
Executing `git config pr-release.labels`
Repository:        masaru-iritani/git-pr-release
Production branch: production
Staging branch:    staging
Template path:     
Labels:            [] + labels on merged PRs
Aggregate Labels:  true
Executing `git rev-parse --is-shallow-repository`
Executing `git remote update origin`
Executing `git log --merges --pretty=format:%P origin/production..origin/staging`
Executing `git ls-remote origin refs/pull/*/head`
Executing `git merge-base 7b52c76689f00bef5c77950534ad11a17908c2de origin/production`
Executing `git config -f .git-pr-release pr-release.token`
Executing `git config pr-release.token`
To be released: #1 Update README.md
Searching for existing release pull requests...
Executing `git config remote.origin.url`
Executing `git config -f .git-pr-release pr-release.mention`
Executing `git config pr-release.mention`
diff: #<Diff::LCS::ContextChange: ["+", [0, nil], [0, "- [ ] #1 @masaru-iritani"]]>
Use line as is: - [ ] #1 @masaru-iritani
Pull request body:
- [ ] #1 @masaru-iritani
Updated pull request: https://github.com/masaru-iritani/git-pr-release/pull/2

Review Points

  • Is aggregate-labels the best name among other ideas such as reuse-labels and summarize-labels, etc.?
  • Should aggregate-labels be given as a command line argument, not environment variable or git config, like other boolean values such as --dry-run and --no-fecth? (It depends on this gem's command line design.)

@masaru-iritani masaru-iritani changed the title Aggregate labels from prs Aggregate labels from merged pull requests Feb 14, 2024
@masaru-iritani
Copy link
Author

@onk Thank you for taking a look into this! I'd like to know if there are any outstanding concerns or areas for improvement necessary for moving this forward. Your feedback would be greatly appreciated. Looking forward to your response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Aggregate labels from pull requests
2 participants