Manage labels for issues and pull requests
Important
As of version v2.0.0
, this action has been converted to ESM.
This action can be used to add and remove labels from issues and pull requests.
Here is a simple example of how to use this action in your workflow. Make sure
to replace vX.X.X
with the latest version of this action.
on:
issues:
types:
- opened
jobs:
example:
name: Example
runs-on: ubuntu-latest
# Write permissions to issues is required
permissions:
issues: write
steps:
# Add labels to an issue in this repository
- name: Add Labels
id: add-labels
uses: issue-ops/labeler@vX.X.X
with:
action: add
issue_number: ${{ github.event.issue.number }}
labels: |
enhancement
great-first-issue
# Remove labels from an issue in this repository
- name: Remove Labels
id: remove-labels
uses: issue-ops/labeler@vX.X.X
with:
action: remove
issue_number: ${{ github.event.issue.number }}
labels: |
enhancement
great-first-issue
- When adding labels, if you specify label(s) that do not exist and
create
is set to'false'
(the default), this action will fail. - When removing labels that do not exist, this action will continue without error.
Input | Default | Description |
---|---|---|
action |
add |
The action (add or remove ) |
create |
'false' |
Create label, if not present |
github_token |
${{ github.token }} |
The GitHub API token to use |
labels |
label1 |
Line-separated label list |
issue_number |
${{ github.event.issue.number }} or ${{ github.event.pull_request.number }} |
The issue or PR numer |
repository |
${{ github.repository }} |
The repository (owner/repo ) |
Warning
If you specify a repository other than the one the action is running in, you
will need to provide a value for the github_token
that has appropriate
permissions (using either a PAT or a GitHub App).