GitHub Action
Automatic Labeler
v2.3
Latest version
Automatically add labels to your pull requests based on file paths and extensions.
github-token: Token used for authentication [required]
with:
github-token: ${{ github.token }}
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.
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 the creator of the pull request as an assignee. [optional]
assign-owner: 'true'
Labels that do not exist will be created with a random color.
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/automatic-labeler@v2.1.0
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'