Add GitHub Labels

Action ID: github:issues:label
NPM Package:

@backstage/plugin-scaffolder-backend-module-github

Description

Adds labels to a pull request or issue on GitHub.

Input Schema

PropertyTypeDescriptionRequired
tokenstringThe `GITHUB_TOKEN` to use for authorization to GitHub
labelsarrayThe labels to add to the pull request or issue
numbernumberThe pull request or issue number to add labels to
repoUrlstringAccepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the repository name and `owner` is an organization or username

Output Schema

No output schema defined for this action.

Usage Examples

Add triage labels to a new issue using template parameters

Use this after repository setup with actions like fetch:template to mark a newly created issue for triage. The issue number, owner, and repository come from template parameters.

Copy
steps:
  - id: label-new-issue
    action: github:issues:label
    input:
      repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.repoOwner }}
      number: ${{ parameters.issueNumber }}
      labels:
        - bug
        - needs triage
      token: ${{ secrets.githubToken }}

Add review labels to a pull request with static values

Use this when you know the repository and pull request number and want to mark the PR as ready for review.

Copy
steps:
  - id: label-pr-for-review
    action: github:issues:label
    input:
      repoUrl: github.com?repo=payments-service&owner=acme-org
      number: 42
      labels:
        - ready for review
        - ci

Apply release labels to a PR with labels from a parameter

Use this after opening a release PR with an action like publish:github:pull-request. Labels are provided by a multi-select template parameter.

Copy
steps:
  - id: label-release-pr
    action: github:issues:label
    input:
      repoUrl: github.com?repo=web-portal&owner=acme-org
      number: ${{ parameters.prNumber }}
      labels: ${{ parameters.releaseLabels }}
      token: ${{ secrets.githubToken }}

Label an issue in a user repository with a mix of static and dynamic labels

Use this to tag an issue in a personal repository after creating it with github:issues:create. One label comes from user input and one is a standard label.

Copy
steps:
  - id: label-doc-issue
    action: github:issues:label
    input:
      repoUrl: github.com?repo=${{ parameters.repo }}&owner=${{ parameters.username }}
      number: ${{ parameters.issueNumber }}
      labels:
        - ${{ parameters.primaryLabel }}
        - documentation
      token: ${{ secrets.githubToken }}

Mark a Dependabot PR for security triage

Use this to tag an automated dependency update PR so it is routed to the right team.

Copy
steps:
  - id: label-dependabot-pr
    action: github:issues:label
    input:
      repoUrl: github.com?repo=platform-infra&owner=acme-org
      number: ${{ parameters.dependabotPr }}
      labels:
        - dependencies
        - security
      token: ${{ secrets.githubToken }}