Automatically copy changelog message to the backport or put no-changelog label#195
Automatically copy changelog message to the backport or put no-changelog label#195
Conversation
de142b8 to
f76b337
Compare
bot/internal/bot/label.go
Outdated
|
|
||
| // If automatic backport body doesn't have changelog entry it means there shouldn't be one, otherwise | ||
| // it would be automatically added. Mark PR with no-changelog label. | ||
| if len(b.getChangelogEntries(prBody)) == 0 && strings.HasPrefix(b.c.Environment.UnsafeHead, botBackportBranchPrefix) { |
There was a problem hiding this comment.
As an alternative to this, should we just copy all labels (except the backport labels). That way if no-changelog (and other attributes) are set on the original PR, they are defaulted to the backport.
There was a problem hiding this comment.
I've removed any changes to the label workflow in this PR, now setting the label on the backport workflow itself, as @r0mant suggested. I think we can actually do copying of all labels on the backport workflow, but I feel like that should be a separate PR if we decide to do that.
| "expand": []string{"1"}, | ||
| "title": []string{fmt.Sprintf("[%v] %v", strings.Trim(base, "branch/"), pull.UnsafeTitle)}, | ||
| "body": []string{fmt.Sprintf("Backport #%v to %v", b.c.Environment.Number, base)}, | ||
| "body": []string{bodyText}, |
There was a problem hiding this comment.
You can just add "labels" here than modifying labels.go, would be a little bit cleaner. I actually had this logic implemented and sitting in #148 for a while but never got a chance to wrap it up.
There was a problem hiding this comment.
There was a problem hiding this comment.
Oh, damn, I tested it and it didn't work for me, now I tried again and it works, because first time I tried it with test label being "label1" and it probably didn't put it because such label doesn't exist 🤦
Will change to setting label here 👍
There was a problem hiding this comment.
Changed. I had to force push to overwrite the commit, because during writing tests for backport flow it accidentally ran real git commands on my machine and overwrote my git user, which I didn't notice until now (it's safe now, dry run in tests).
f76b337 to
7fdf32c
Compare
7fdf32c to
07a5800
Compare
|
Thanks @AntonAM! |
With the new requirement of specifying changelog in the PR body or no-changelog label there's a problem with automatic backports, since they automatically fail those requirements. This PR improves backporting procedure by copying changelog message from the parent PR if it's present, or setting no-changelog label.