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

label-pull-request: add except #89

Merged
merged 4 commits into from
Sep 27, 2020
Merged

Conversation

SeekingMeaning
Copy link
Contributor

@SeekingMeaning SeekingMeaning commented Sep 15, 2020

This adds an except field to label-pull-request that allows files to be excluded by absolute path, i.e. without regex

Example:

{
    "label": "legacy",
    "path": "Formula/.+@.+",
    "except": [
        "Formula/python@3.8",
        "Formula/python@3.9"
    ]
}

Related: Homebrew/homebrew-core#61163

@@ -74,6 +74,7 @@ async function main() {
if (
(!constraint.status || file.status == constraint.status) &&
(!constraint.path || file.filename.match(constraint.path)) &&
(!constraint.except || (Array.isArray(constraint.except) ? constraint.except.includes(file.filename) : file.filename == constraint.except)) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to split this onto multiple lines or a separate variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this?

(!constraint.except ||
    (Array.isArray(constraint.except) ?
        constraint.except.includes(file.filename) :
        file.filename == constraint.except)) &&

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better! Think ternary would be nice to avoid here but don't feel strongly.

@dawidd6 dawidd6 merged commit 30ee31b into Homebrew:master Sep 27, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants