GithubHelp home page GithubHelp logo

issue-labeler's Introduction

Issue Labeler

Issue labeler will label issues based on the body content of the issue.

Usage

Create .github/labeler.yml

Create a .github/labeler.yml file with a list of labels and regex to match to apply the label.

The key is the name of the label in your repository that you want to add (eg: "merge conflict", "needs-updating") and the value is the regular expression for when to apply the label. Should the regular expression not match, the label will be removed.

Basic Examples

# Add/remove 'critical' label if issue contains the words 'urgent' or 'critical'
critical:
    - '(critical|urgent)'

Label All Issues

# Add 'critical' label to any issue that gets opened
critical:
    - '/.*/'

Create Workflow

Create a workflow (eg: .github/workflows/labeler.yml see Creating a Workflow file) to utilize the labeler action with content:

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected] #May not be the latest version
      with:
        configuration-path: .github/labeler.yml
        not-before: 2020-01-15T02:54:32Z
        enable-versioned-regex: 0
        repo-token: ${{ github.token }}

not-before is optional and will result in any issues prior to this timestamp to be ignored.

Example using versioned issue templates

As you iterate on your regular expressions, since maybe your issue template gets updated, this can have an impact on existing issues. The below allows you to version your regular expression definitions and pair them with issue templates.

Below is the body of an example issue which has the version identifier issue_labeler_regex_version embedded.

<!--
issue_labeler_regex_version=1
--!>

I have an urgent issue that requires someone's attention.

Below is the workflow file

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected] #May not be the latest version
      with:
        configuration-path: .github/labeler.yml
        not-before: 2020-01-15T02:54:32Z
        enable-versioned-regex: 1
        versioned-regex: 'issue_labeler_regex_version=(\d+)'
        body-missing-regex-label: 'broken-template'
        repo-token: ${{ github.token }}

When the issue is evaluated it'll look for .github/labeler-v1.yml based on the configuration-path and the version number set in the issue.

When you reach a point where you'd like to update your labels and regular expressions and it could cause a conflict with historic issues, simply update your issue template to include issue_labeler_regex_version=2 and create the file .github/labeler-v2.yml. The issue will automatically be matched to the correct set of regular expressions.

Set versioned-regex to any valid regular expression that should be used to capture the version number from the issue. The first match will be used should multiple be found.

Set body-missing-regex-label to the name of the label that should be added to an issue where the specified version-regex can't be found. This is useful for when your users accidentally delete this value. Leave this blank if you don't want to use this functionality.

Pull request support

The labeler action is also available for pull requests. Make sure the workflow is triggered by pull requests.

on:
  pull_request:
    types: [opened, edited]

Example including the issue title in the regex target

Set include-title to 1 to include the issue title in addition to the body in the regular expression target.

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected] #May not be the latest version
      with:
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0
        include-title: 1
        repo-token: ${{ github.token }}

Example of only including the issue title, but not the body in the regex target

Set include-title: 1 and include-body: 0.

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected] #May not be the latest version
      with:
        configuration-path: .github/labeler.yml
        include-title: 1
        include-body: 0

Syncing Labels

By default, labels that no longer match are not removed from the issue. To enable this functionality, explicity set sync-labels to 1.

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0
        sync-labels: 1
        repo-token: ${{ github.token }}

issue-labeler's People

Contributors

amerikan avatar balazsorban44 avatar cgreene avatar commanderroot avatar dokimiki avatar eaftan avatar endbug avatar hedyhli avatar jamesbt365 avatar jinzhu avatar lrstanley avatar lyndseypadget avatar myakura avatar phated avatar rajbos avatar renanfranca avatar stephanmiehe avatar superbrothers avatar yousseflasheen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

issue-labeler's Issues

Error running workflow: "Input required and not supplied: repo-token"

I'm running this GH Action workflow on a public repo and it is failing with Failure "Error: Input required and not supplied: repo-token". My workflow is:

name: 'Issue Labeler'
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - uses: github/[email protected]
        with:
          configuration-path: .github/issue-labeler.yml
          enable-versioned-regex: 0

Any suggestions on how to resolve?

HttpError: Resource not accessible by integration

I keep getting HttpError: Resource not accessible by integration when it runs. My config is:

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

permissions:
  issues: write

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - uses: github/[email protected]
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          configuration-path: .github/labeler-issue-regex.yml
          enable-versioned-regex: 0
          sync-labels: 1
          include-title: 1

`UnhandledPromiseRejectionWarning: HttpError: Label does not exist` on issues where not all labels are to be applied

I'm trying out this action; it works but I get UnhandledPromiseRejectionWarning(s) while the action is running:

Adding labels bug to issue #11
Removing label test from issue #11
(node:1471) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
at /home/runner/work/_actions/github/issue-labeler/v2.4.1/node_modules/@octokit/request/dist-node/index.js:76:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1471) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1471) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It looks like it happens when not all labels are to be applied (i.e. most cases). Suppose I have the following label-matching definitions:

test:
  - '(test)'
bug:
  - '(bug)'

When an issue is filed with a body that contains both "test" and "bug", I don't see any warning. However, when the issue only contains either "test" or "bug", I see a warning. If the body contains neither, I see two warnings.

Labeler always correctly adds expected label, but sometimes then incorrectly immediately and unexpectedly removes the label

For MDN we’re using v2.5 to label just new issues (not to re-label existing ones) and it works as expected almost all the time — but occasionally it will unexpectedly remove a label it has just added.

mdn/content#16309 (comment) is an example.

The relevant config files are here:

https://gist.github.com/sideshowbarker/c25f8f87747c68d0409c14db9b56bcd9 is a copy of the raw log for the workflow run.

In looking at that log, I notice that while there’s an event logged for when the expected label is added, there’s actually no event logged that shows it being removed.

Note that in addition to github/issue-labeler, we also run andymckay/labeler, to do just one thing: add a needs-triage label.

The config file for that is at https://github.com/mdn/content/blob/main/.github/workflows/new-issues.yml

Error when running action: `Cannot find module '@actions/core`

I was trying out issue-labeler at the current HEAD commit (772f647), but I get this error:

internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module '@actions/core'
Require stack:
- /home/runner/work/_actions/github/issue-labeler/[7](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:7)72f6472f461fbfca5d953d5715a41db1ef5dfe4/lib/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:[8](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:8)15:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:1[9](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:9))
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/work/_actions/github/issue-labeler/772f6472f461fbfca5d953d5715a41db1ef5dfe4/lib/main.js:19:27)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:[10](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:10)27:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:[12](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:12)) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/_actions/github/issue-labeler/772f6472f461fbfca5d953d57[15](https://github.com/github/copilot-planning/runs/5456532223?check_suite_focus=true#step:2:15)a41db1ef5dfe4/lib/main.js'
  ]
}

The problem may be that JavaScript Actions are supposed to have the node_modules directory checked in, as documented here. Note also that the doc recommends checking in package-lock.json.

I'm not sure why this worked before without the node_modules directory checked in 🤷

HttpError: Label does not exist (although it is defined for the project)

Related issues #20, #32
Related PRs #57

With issue-labeler version 2.5, I got UnhandledPromiseRejectionWarning: HttpError: Label does not exist warnings but the workflow passed and the PRs got labelled as expected (e.g. andthum/mdtools#138, https://github.com/andthum/mdtools/actions/runs/4076674579/jobs/7024720065).

Now with issue-labeler version 2.6, I get HttpError: Label does not exist errors and the workflow fails, although the PRs still get labelled as expected (e.g. andthum/mdtools#140, https://github.com/andthum/mdtools/actions/runs/4113712400/jobs/7100168530).

I think this behavior change was introduced with PR #57.

My questions:

  1. Why does the warning (v2.5) / error (v2.6) pop up at all? The labels have been defined for the repository (https://github.com/andthum/mdtools/labels).
  2. What do I have to do to fix the HttpError: Label does not exist error?

If this helps: My issue-labeler config file can be found here and my issue-labeler workflow is defined here.

@balazsorban44: If you have time and the required expertise, could you please help me out? Many thanks!

Labeler fails when issue body is empty

When I attempt to use this labeler to label a new issue with an empty body, I get the following error message: "Could not get issue number or issue body from context, exiting".

We often turn task list entries into issues, and they are created with an empty body with no way to enter one. So the labeler fails whenever we do that.

issue-labeler does not run on issues created by github-actions bot

I am using the Github Action Manual Approval so that developers need to approve a deployment. This automatically creates an issue which I would like to automatically add the label hidden to.

When I manually create an issue, the issue-labeler correctly runs and adds a label.
However, when the issue is automatically created/closed by the Manual Approval Github Action, the issue-labeler does not run.

Does anyone know why that is or how to get the labeler to run?

Warning: Unexpected input(s) 'not-before'

Hi! It looks like not-before has stopped working. I'm getting this error:

Warning: Unexpected input(s) 'not-before', valid inputs are ['repo-token', 'configuration-path', 'enable-versioned-regex']

I'm using version 2.4. Here's my workflow file:

name: Issue Opened Triage

on:
  issues:
    types: [opened]
  workflow_dispatch:
  push:
    branches:
      - testlabelworkflow

permissions:
  actions: none
  checks: none
  contents: none
  deployments: none
  issues: write
  packages: none
  pull-requests: none
  repository-projects: none
  security-events: none
  statuses: none

jobs:
  issue_triage:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
    - name: Label new issue
      uses: github/issue-labeler@829a8bf1b184f74cc575b5435093a92c7b846983
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler-issue-triage.yml
        enable-versioned-regex: 0
        not-before: 2021-06-01T00:00:00Z

Thanks!

Read default GitHub token

The repo-token input doesn't need to be mandatory, you can read the default value like this:

  repo-token:
    description: 'The GITHUB_TOKEN secret'
    default: ${{ github.token }}
    required: false

Support Pull Requests

I would like to use issue-labeler for Pull Requests.

Currently it does not work for Pull Requests in the following workflow:

name: Issue Labeler
on:
  issues:
    types: [opened, edited]
  pull_request:
    types: [opened, edited]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0

Auto select filter when clicking labels

Situation: I want to quickly add a single label to an existing issue. However, if I click labels, I have to then click the text filter to begin refining. Auto selecting the input would save some time.

Reproduce:

  • Create issue
  • Click Labels in right sidebar
  • Click input
  • Start typing

End goal:

  • Create issue
  • Click Labels in right sidebar
  • Start typing

New feature: Create label if it does not exist

When I try to put up a non-existent label, I get the following error:

(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1680) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:1680) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.4/node_modules/@octokit/request/dist-node/index.js:76:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)

There should be a flag to force the creation of the label.
Is this possible?

Match whole word

Is it possible to match a word?

For instance, I have this rule defined in my .github/labeler.yml file:

SEC:
  - "(SEC)"

if I have the following URL in the body:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

It will apply the label SEC on the issue, which is normal.

But how can I restrict the rule to check only (SEC) with the parenthesis?

For instance
Cloud Security (SEC)

Error: AggregateError

Error:

Configuration file (path: .github/labeler.yml) does not exist locally, fetching via the API
Could not add label(s) Engine to issue #262
Error: AggregateError

Workflow:

name: "Workflow / Pull Request Labeler"

on:
  pull_request:
    types: [opened, edited]
    
jobs:
  labeler:
    name: Add labels to Pull Request

    runs-on: ubuntu-latest

    steps:
    - name: Add labels to Pull Request
      uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0
        include-title: 1

Add example of `enable-versioned-regex`

The readme shows usage of enable-versioned-regex, but it doesn't explain what this does or why it should be used.

Is the property required? If not, what is the default if omitted?

unable to auto label all issues with a regex maching any string

We want to have all new issues in a repo to be labeled, unfortunately I was unable to set this up. Here is what I have:

labeler:

critical:
    - '^.*$'

Btw, I've tried '.*', '' as regexes and nothing worked - i.e. the label was to applied.
The label "critical" was created as a custom label. We are using a PM tool and want all issues from this repo have a bright label.
Thanks!

workflow:

name: "Issue Labeler"
on:
  issues:
    types: [opened]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0

Option to not remove label?

I really like the ability to automatically apply labels if a specific word is found, but having the same labels removed because the word is missing can be problematic.

For instance, I label bug to any issue that as that word, but the label was manually tagged as a bug without using the word in the body, it just gets removed at some point and we lose track of the bug!

Maybe something like follows could be considered?

bug: 
   add: false
   remove: false
   regex: 
     - bug
     - ....

support reading from filesystem rather than using the API to fetch configuration file

Looks as though the action is currently hardcoded to use the API to pull the configuration file, as shown below:

issue-labeler/src/main.ts

Lines 133 to 138 in 772f647

const response = await client.repos.getContents({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
path: repoPath,
ref: github.context.sha
});

However, with reusable workflows being a thing, where one might want to centralize some of the common configurations in a .github repository, this doesn't work, unless the config is in the target repo, rather than the reusable repository.

Below is an example workflow, that is a reusable workflow, and it clones my personal lrstanley/.github repository, where most of my triage-related configuration files are stored. I'd like to be able to read from that repo.

name: triage

on: [workflow_call]

jobs:
  issues:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      contents: read
    steps:
      - name: git-clone-tools-repo
        uses: actions/checkout@v3
        with:
          repository: lrstanley/.github
      - name: label-issues
        uses: github/issue-labeler@99b4c5dda477c65f4ef08486b73c5787e1e33601
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          configuration-path: triage/label-issues.yml
          enable-versioned-regex: 0

Most actions I've used so far (esp. relating to labeling), will read from a local file for the configuration. It would be nice if this action could support first trying to see if $PWD/<configuration-path> exists, and if not, falling back to using the content API.

Could not add label(s) to issue

Example workflow: https://github.com/GreptimeTeam/greptimedb/actions/runs/7327676623/job/19954858878
Config yml: https://github.com/GreptimeTeam/greptimedb/blob/develop/.github/doc-label-config.yml
Workflow file: https://github.com/GreptimeTeam/greptimedb/blob/develop/.github/workflows/doc-label.yml

Error:

Run github/[email protected]
Configuration file (path: .github/doc-label-config.yml) does not exist locally, fetching via the API
Could not add label(s) Doc not needed to issue #3007
Error: AggregateError

Hi, I encountered this issue on trying to use issue-labeler to add labels based on PR description. I guess this is caused by some permission problem, but I don't know the actual reason from the error message. And that token secrets.GITHUB_TOKEN works well on other workflows, example.

And I've tried this config on my forked repo, it also works as expected: waynexia/greptimedb#2

Running with less privilege

This requires use of GITHUB_TOKEN which means read/write repo privilege. Could the GITHUB_TOKEN be replaced with an Oauth token that only has triage privilege on the repo?

GitHub Enterprise Server

Hello,

Should this action work by default on GHES?

This is what I get when I test it:

image

Cheers,

emil

Could not get issue number or issue body from context, exiting

I have a very simple workflow to label all issues with "needs-triage".

Workflow:

name: "Issue Labeler"
on:
  issues:
    types: [opened, reopened]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0

Configuration file:

needs-triage:
    - '(?i).*.*'

However I am getting a "Could not get issue number or issue body from context, exiting" message.

See the workflow run here for full logs: https://github.com/redhat-developer/app-services-cli/runs/3243472455?check_suite_focus=true

Investigate using a single yml file for managing regex

Currently versions are broken out into dedicated yml files. This can lead to duplicates between versions. Explore using a single file and making iterating on rules simpler without the need to duplicate information.

Issue-labeler removes labels when regex does not match

👋🏻 I've setup an issue-labeler action that looks for regex in an issue title.

Currently, the README says that for this action:

Should the regular expression not match, the label will be removed.

But I want this action to be additive. So if the title of the created issue says:

"Data analysis for x, y ,z"

Apply the data label.

Currently if someone else creates an issue called:

"This is another issue for another topic" and manually adds the label other

The action will remove the other label.

Is there a way to make this action work so that if the regex in title matches what I setup in action it applies the label, otherwise if regex doesn't match, the user-added-labels are kept?


A bit more context:

I tried setting sync-labels: 1 as suggested in the README and sync-labels: '' as suggested in previous issues in this repo. In both instances, previously added labels that didn't align with the regex were removed.

When we look at the defaults for sync-labels we see:

  sync-labels:
    description: 'Remove the label from the issue if the label regex does not match'
    required: false
    default: "0"

If default is 0, shouldn't setting sync-labels: 1 turn syncing on? Should I try some other setting for sync-labels like sync-labels: 0 or sync-labels: false?

Thanks!

CC: @MgenGlder

HttpError: Label does not exist

Hello,

I'm trying to debug an issue i'm having using this action and my labels are created.

If you have any idea why i'm getting this error please !
It would be really appreciated 🙏🏽
Thank you

here is the logs :

Warning: Unexpected input(s) 'enable-versioned-regex', valid inputs are ['repo-token', 'configuration-path']
Run github/[email protected]
(node:2480) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
Removing label ✨ Lightning from issue #1
    at /home/runner/work/_actions/github/issue-labeler/v2.0/node_modules/@octokit/request/dist-node/index.js:66:23
Removing label 🔥 Normal from issue #1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Removing label ☀️ Long from issue #1
(node:2480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Removing label ⏱️ Durée libre from issue #1
(node:2480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2480) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.0/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2480) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.0/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:2480) UnhandledPromiseRejectionWarning: HttpError: Label does not exist
    at /home/runner/work/_actions/github/issue-labeler/v2.0/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

.github/labeler.yml

'✨ Lightning':
  - '- [x] 5 minutes'
'🔥 Normal':
  - '- [x] 20 minutes'
'☀️ Long':
  - '- [x] 30 minutes'
'⏱️ Durée libre':
  - '- [x] Précisez :'

.github/workflows/labeler.yml

name: "Issue Labeler"
on:
  issues:
    types: [opened, edited]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: github/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        enable-versioned-regex: 0

My labels exists in the repository :
image

Repository link if you need it : https://github.com/StrasbourgJS/talks

Giving regex flags

How can I set flags to ignore case? I know it is /i but need help with putting it in the .yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.