Skip to content

Automatic Labeler

Actions
Add automatic labels
v2.3
Latest
Star (0)

Automatic Pull request Labeler

Automatically add labels to your pull requests based on file paths and extensions.

Action Options

github-token: Token used for authentication [required]

with:
  github-token: ${{ github.token }}

paths:

Apply a label based on directory changes [optional]

with:
  paths: |
    .github/: "workflows"
    backend/src/: "backend"

This will apply the labels workflows and backend when the pull request includes any changed files in either directories.

languages:

Apply a label based on a file extension [optional]

languages: |
  ts: "typescript"
  js: "typescript"
  tsx: "react"
  jsx: "react"
  yml: "config"
  yaml: "config"
  json: "config"
  md: "documentation"
  sh: "scripting"
  Dockerfile: "docker"

This will apply the labels if any file changes are detected with the extensions .ts, .js, .tsx, or .jsx, etc.

assign_owner:

Assign the creator of the pull request as an assignee. [optional]

assign-owner: 'true' 

Labels

Labels that do not exist will be created with a random color.

A full example using this action:

name: "Automatic PR Labeler"
on:
  pull_request:
    types: [opened]
permissions: // Required permissions for action to work properly
  contents: read // Read content from repository
  pull-requests: write // Read and edit pull requests
  repository-projects: read // Read GITHUB_TOKEN
jobs:
  label:
    runs-on: ubuntu-latest
    env:
      GH_TOKEN: ${{ github.token }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 // Fetch the entire history of the repository
      - name: Assign labels
        uses: shanearcaro/[email protected]
        with:
          paths: |
            .github/: "workflows"
            backend/src/: "backend"
          languages: |
            ts: "typescript"
            js: "typescript"
            tsx: "react"
            jsx: "react"
            yml: "config"
            yaml: "config"
            json: "config"
            md: "documentation"
            sh: "scripting"
            Dockerfile: "docker"
          assign-owner: 'true'

Automatic Labeler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Add automatic labels
v2.3
Latest

Automatic Labeler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.