diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000000..380ff441c04a --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,23 @@ +# https://github.com/actions/labeler?tab=readme-ov-file#usage + +# Add the `4.8` label to PRs that target the `4.8` branch. +'4.8': # @todo change value whenever the next minor version is changed +- base-branch: '4.8' + +# Add the `github_actions` label to PRs that change any file in the `.github/workflows/` directory. +'github_actions': +- changed-files: + - any-glob-to-any-file: + - '.github/workflows/*' + +# Add the `documentation` label to PRs that change any file in the `user_guide_src/source/` directory. +'documentation': +- changed-files: + - any-glob-to-all-files: + - 'user_guide_src/source/*' + +# Add the `testing` label to PRs that change files in the `tests/` directory ONLY. +'testing': +- changed-files: + - any-glob-to-all-files: + - 'tests/*' diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 000000000000..730c98f271c1 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,20 @@ +name: Add Labels to PRs + +# NOTE: When updating this workflow, you should first change the event to `pull_request` to test the changes +# in a PR, and then change it back to `pull_request_target` before merging. +# @see https://github.com/actions/labeler?tab=readme-ov-file#updating-major-version-of-the-labeler +on: + - pull_request_target + +jobs: + add-labels: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-24.04 + + steps: + - name: Add labels + uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1 + with: + sync-labels: true # Remove labels when matching files are reverted