ci: label the PRs that change the gazelle and sphinxdocs subtrees (#4574) Add the `gazelle` and `sphinxdocs` labels to the PRs that change the files in the `gazelle/` and `sphinxdocs/` subtrees with `actions/labeler`. The workflow uses `pull_request_target`, so that the PRs from forks can be labelled, and it does not check out the code of the PR. The labels are only added and the ones that are set manually are kept.
diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..cf45d2a --- /dev/null +++ b/.github/labeler.yml
@@ -0,0 +1,8 @@ +# The labels that are added to the PRs based on the changed files. See +# https://github.com/actions/labeler for the syntax. +gazelle: + - changed-files: + - any-glob-to-any-file: "gazelle/**" +sphinxdocs: + - changed-files: + - any-glob-to-any-file: "sphinxdocs/**"
diff --git a/.github/workflows/pr-labeler.yaml b/.github/workflows/pr-labeler.yaml new file mode 100644 index 0000000..8d95d2c --- /dev/null +++ b/.github/workflows/pr-labeler.yaml
@@ -0,0 +1,24 @@ +name: "PR Labeler" + +on: + # NOTE: pull_request_target is needed to label the PRs from forks. The + # workflow must not check out or run the code of the PR. + pull_request_target: + types: + - opened + - synchronize + - reopened + +permissions: {} + +jobs: + label: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/labeler@v7 + with: + # The labels are only added, so that the manually set labels stay. + sync-labels: false