Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler
# This workflow triages pull requests and applies labels based on changed paths.
# It is resilient when labeler config is missing on the base branch.

name: Labeler
on: [pull_request_target]

on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
label:

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- uses: actions/labeler@v5.0.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

- name: Verify labeler config exists
id: labeler_config
shell: bash
run: |
if [[ -f ".github/labeler.yml" ]]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "::warning title=Labeler config missing::.github/labeler.yml not found on base branch; skipping labeler."
fi

- name: Apply labels
if: steps.labeler_config.outputs.exists == 'true'
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yml
Loading