-
Notifications
You must be signed in to change notification settings - Fork 74
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 #56
Conversation
8671969
to
9263223
Compare
:assignees: [] | ||
:requested_reviewers: [] | ||
:requested_teams: [] | ||
:labels: [] | ||
:milestone: | ||
:labels: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 This example comes from the ofiicial API reference.
https://docs.github.com/en/rest/reference/pulls#get-a-pull-request--code-samples
@@ -75,7 +76,8 @@ def configure | |||
say "Production branch: #{production_branch}", :debug | |||
say "Staging branch: #{staging_branch}", :debug | |||
say "Template path: #{template_path}", :debug | |||
say "Labels #{labels}", :debug | |||
say "Labels: #{labels}#{aggregate_labels ? ' + labels on merged PRs' : ''}", :debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to show merged labels but it couldn't determine all labels to be added here.
Because it calls fetch_merged_prs
after configure
.
Due to the same reason, I was compelled to add a destructive substitution to @labels
in fetch_merged_prs
.
git-pr-release/lib/git/pr/release/cli.rb
Line 122 in 9263223
@labels = (labels + merged_prs_labels).uniq |
``` $ git config pr-release.aggregate_labels error: invalid key: pr-release.aggregate_labels ```
This change got unnecessary for me, so I'm closing. |
@ohbarye I believe this feature is exactly what my team needs. Would it be possible for you to reopen this pull request, or would you prefer that I take over the work? |
@masaru-iritani Sure. Please go ahead as you like! |
@onk @motemen
Issue
Closes #54
Changes
As described in #54, I added
aggregate_labels
feature.pr-release.aggregate_labels
config (orGIT_RELEASE_PR_AGGREGATE_LABELS
)."true"
or anything"true"
,git-release-pr
aggregates labels from merged pull requests.pr-release.labels
is given at the same time?pr-release.labels
setting.pr-release.labels=foo,bar
and aggregated labels arebaz
, then labels would be["foo", "bar", "baz"]
.Testing
That worked well on my own
$ GIT_PR_RELEASE_BRANCH_STAGING=release GIT_PR_RELEASE_LABELS=release GIT_PR_RELEASE_AGGREGATE_LABELS=true bundle exec git-pr-release
Review Points
aggregate_labels
an appropriate name?reuse_labels
,summarize_labels
... etc.aggregate_labels
be given as a command line arg, not environment variable or git config?--dry-run
,--no-fecth
,aggregate_labels
is boolean-ish value. So I wonder if it should be. (It depends on this gem's command line design.)