Skip to content
check-square

GitHub Action

IssueOps Label Manager

v2.1.0 Latest version

IssueOps Label Manager

check-square

IssueOps Label Manager

Manage labels for issues and pull requests

Installation

Copy and paste the following snippet into your .yml file.

              

- name: IssueOps Label Manager

uses: issue-ops/labeler@v2.1.0

Learn more about this action in issue-ops/labeler

Choose a version

IssueOps Labeler

Check dist/ CodeQL Continuous Integration Continuous Delivery Linter Code Coverage

Manage labels for issues and pull requests

Important

As of version v2.0.0, this action has been converted to ESM.

About

This action can be used to add and remove labels from issues and pull requests.

Setup

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

Behavior

  • 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.

Inputs

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).