x-motemen / git-pr-release

Release pull request generator
https://rubygems.org/gems/git-pr-release
MIT License
689 stars 76 forks source link

Aggregate labels from merged pull requests #97

Open masaru-iritani opened 8 months ago

masaru-iritani commented 8 months ago

@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.

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

masaru-iritani commented 8 months ago

@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!