kodiak icon indicating copy to clipboard operation
kodiak copied to clipboard

Feature Request: Can kodiak use multiple automerge_label?

Open styfle opened this issue 4 years ago • 9 comments

Problem

We are thinking of changing our PRs to require labels to merge.

Rather than adding a new bot, I was wondering if Kodiak could enforce this requirement.

Possible Solutions

Use an array: merge.automerge_label = ["semver-major", "semver-minor", "semver-patch"]

Use a regex pattern: merge.automerge_label_pattern = "^semver-(.*)$"

Must match all patterns: merge.automerge_label_pattern = ["^semver-(.*)$", "^type-(.*)$"]

styfle avatar Oct 09 '20 17:10 styfle

I started this as a question and then changed to a feature request 😄

styfle avatar Oct 09 '20 17:10 styfle

This change hasn't been documented or released yet, but I think it may be what you want: https://github.com/chdsbd/kodiak/pull/516

Although looking at your suggestions it might be less confusing if we have merge.automerge_label accept an array as you suggested instead of adding the automerge_labels field.

chdsbd avatar Oct 09 '20 18:10 chdsbd

Although looking at your suggestions it might be less confusing if we have merge.automerge_label accept an array as you suggested instead of adding the automerge_labels field.

Either way seems fine to me 👍

I'm particularly fond of the last solution I suggested because it allows for requiring 2 labels (or more) which opens up really nicely labelled PRs.

merge.automerge_label_pattern = ["^semver-(.*)$", "^type-(.*)$"]

This example would require both the semver prefixed label and the type prefixed label.

styfle avatar Oct 09 '20 19:10 styfle

Do you foresee needing multiple patterns?

Also, do you think you'll need anything to do semver comparisons, like only matching on minor version changes?

chdsbd avatar Oct 09 '20 20:10 chdsbd

Do you foresee needing multiple patterns?

Perhaps in the future yes.

The idea is to avoid PR Templates with checkboxes because that data is not easily searched/filtered compared to labels.

Also, do you think you'll need anything to do semver comparisons, like only matching on minor version changes?

I didn't think about it at first but now that you bring it up, maybe kodiak could increase the number of reviewers required for semver-major 😮

That part is not necessary though. The purpose of the semver label is to create metadata for release notes and also filter PRs to show all semver-major in the previous release in case there was an unexpected regression.

styfle avatar Oct 10 '20 14:10 styfle

Would you want to require every PR to have these labels? If so, I think a GitHub action to enforce the label requirements might be helpful.

chdsbd avatar Oct 10 '20 23:10 chdsbd

Would you want to require every PR to have these labels

Yes that is the goal: labels required to merge.

Indeed, another bot or action would help but it would be nice to have requirements to merge codified with Kodiak.

If this is out of scope, feel free to close 🙂

I think #516 will solve the problem for the time being once that is released 👌

styfle avatar Oct 11 '20 21:10 styfle

#516 was replaced with #522 and deployed on Saturday. However, I'm not sure that change is what you want because any of the labels specified by merge.automerge_label = ["ship it!", "merge"] will trigger merge.

I'm open to expanding Kodiak to support linting pull requests, but it might be quicker to write an action for your specific use case.

Maybe a pull request lint config could look like the following.

[pull_request.requirement]
# require semver labels
labels = ["semver-major", "semver-minor", "semver-patch"]
# require Jira ticket number in title
title_regex = ".*JIRA-\d+.*"
# not sure what else to lint on

chdsbd avatar Oct 13 '20 23:10 chdsbd

I'm open to expanding Kodiak to support linting pull requests,

That would be really nice 👍

It think #522 is going to solve our use case for now, thanks!

styfle avatar Oct 15 '20 22:10 styfle

Closing since we don't need this anymore.

styfle avatar Jan 16 '24 22:01 styfle