Skip to content

Thoughts on supporting case insensitivity? #75

@codfish

Description

@codfish

Thoughts on supporting case insensitivity out of the box OR adding it as an input?

https://github.com/mheap/github-action-required-labels/blob/main/index.js#L93C7-L93C77

- const appliedLabels = labels.map((label) => label.name);
+ const appliedLabels = labels.map((label) => label.name);
+ const lowerCaseAppliedLabels = appliedLabels.map((label) => label.toLowerCase());

- intersection = providedLabels.filter((x) => appliedLabels.includes(x))
+ intersection = providedLabels.filter((x) => lowerCaseAppliedLabels.includes(x.toLowerCase()))

The use case here is that we want to use this in a composite across repos but some repos have a "Do Not Merge" label spelled in different ways. In order to appropriately handle this, we have to do something like:

    - uses: mheap/github-action-required-labels@fab3b73a9443656a796639b75fe08d4eb8c75e75
      with:
        mode: exactly
        count: 0
        labels: "DO NOT MERGE, Do Not Merge, Do not merge, do not merge"
        add_comment: true

But that's obviously got a little bit of a smell to it, and the comment that get's posted isn't ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions