Skip to content

Commit 451b656

Browse files
authored
chore: add labeler action workflow (#10055)
* chore: add labeler action workflow * chore: change event to `pull_request_target` right before merge
1 parent 37a4b1c commit 451b656

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/labeler.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# https://github.com/actions/labeler?tab=readme-ov-file#usage
2+
3+
# Add the `4.8` label to PRs that target the `4.8` branch.
4+
'4.8': # @todo change value whenever the next minor version is changed
5+
- base-branch: '4.8'
6+
7+
# Add the `github_actions` label to PRs that change any file in the `.github/workflows/` directory.
8+
'github_actions':
9+
- changed-files:
10+
- any-glob-to-any-file:
11+
- '.github/workflows/*'
12+
13+
# Add the `documentation` label to PRs that change any file in the `user_guide_src/source/` directory.
14+
'documentation':
15+
- changed-files:
16+
- any-glob-to-all-files:
17+
- 'user_guide_src/source/*'
18+
19+
# Add the `testing` label to PRs that change files in the `tests/` directory ONLY.
20+
'testing':
21+
- changed-files:
22+
- any-glob-to-all-files:
23+
- 'tests/*'

.github/workflows/label-pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Add Labels to PRs
2+
3+
# NOTE: When updating this workflow, you should first change the event to `pull_request` to test the changes
4+
# in a PR, and then change it back to `pull_request_target` before merging.
5+
# @see https://github.com/actions/labeler?tab=readme-ov-file#updating-major-version-of-the-labeler
6+
on:
7+
- pull_request_target
8+
9+
jobs:
10+
add-labels:
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
runs-on: ubuntu-24.04
15+
16+
steps:
17+
- name: Add labels
18+
uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
19+
with:
20+
sync-labels: true # Remove labels when matching files are reverted

0 commit comments

Comments
 (0)