From 0467b7b4b8f0b3ad4d920e88f054233acadb3de0 Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 29 Jul 2026 15:26:16 +0200 Subject: [PATCH] ci: label pull requests from their changed paths Issue labels were applied by hand in a single pass, and pull requests carried no area label at all. Path to area mapping does not need judgement, so it can run on its own. Uses pull_request_target because a pull_request run from a fork gets a read-only token and cannot add labels. The workflow never checks out or runs pull request code, it only reads the changed file list. Signed-off-by: mesutoezdil --- .github/labeler.yml | 46 ++++++++++++++++++++++++++++++++ .github/workflows/pr-labeler.yml | 22 +++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/pr-labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..bf8b54479 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,46 @@ +area/docs: + - changed-files: + - any-glob-to-any-file: + - "docs/**" + - "versioned_docs/**" + - "versioned_sidebars/**" + - "tutorials/**" + - "sidebars.js" + - "sidebars-tutorials.js" + - "versions.json" + +area/ui: + - changed-files: + - any-glob-to-any-file: "src/**" + +area/blog: + - changed-files: + - any-glob-to-any-file: "blog/**" + +area/i18n: + - changed-files: + - any-glob-to-any-file: "i18n/**" + +area/edge-functions: + - changed-files: + - any-glob-to-any-file: + - "netlify/**" + - "netlify.toml" + +area/ci-infra: + - changed-files: + - any-glob-to-any-file: + - ".github/**" + - "scripts/**" + - "package.json" + - "package-lock.json" + - ".markdownlint.json" + - ".prettierrc" + - ".prettierignore" + +area/seo: + - changed-files: + - any-glob-to-any-file: + - "static/robots.txt" + - "static/llms.txt" + - "docusaurus.config.js" diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 000000000..b5108b4d8 --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,22 @@ +name: PR Labeler + +# pull_request_target is used so that pull requests opened from forks get +# labeled too. A pull_request run from a fork has a read-only token and cannot +# add labels. This workflow never checks out or executes pull request code, it +# only reads the changed file list, so the elevated token is not exposed to it. +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + label: + name: Label by changed paths + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 + with: + sync-labels: false