diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..c3e18926 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,66 @@ +# Path -> label rules for .github/workflows/pull-request-label.yml + +documentation: + - changed-files: + - any-glob-to-any-file: + - 'pages/**/*.md' + - '*.md' + +blog: + - changed-files: + - any-glob-to-any-file: + - 'pages/blog/**' + - 'layouts/Blog/**' + - 'layouts/Post/**' + - 'scripts/data/blog.mjs' + - 'scripts/rss-feed/**' + - '.github/workflows/create-blog-post.yml' + +theme: + - changed-files: + - any-glob-to-any-file: + - 'components/**' + - 'layouts/**' + - 'styles/**' + - 'hooks/**' + - 'plugins/theme/**' + - 'public/**' + +tooling: + - changed-files: + - any-glob-to-any-file: + - 'scripts/**' + - 'plugins/processor/**' + - 'plugins/shared/**' + - 'utils/**' + - 'api/**' + - 'eslint-local-rules/**' + - 'versions.json' + - 'vercel.json' + - 'tsconfig.json' + - 'eslint.config.mjs' + - '.stylelintrc.mjs' + - '.stylelintignore' + - '.prettierrc.json' + - '.prettierignore' + - '.lintstagedrc' + - '.gitignore' + - '.husky/**' + +tests: + - changed-files: + - any-glob-to-any-file: + - 'tests/**' + +dependencies: + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + +github_actions: + - changed-files: + - any-glob-to-any-file: + - '.github/workflows/**' + - '.github/dependabot.yml' + - '.github/labeler.yml' diff --git a/.github/workflows/pull-request-label.yml b/.github/workflows/pull-request-label.yml new file mode 100644 index 00000000..f7ede63b --- /dev/null +++ b/.github/workflows/pull-request-label.yml @@ -0,0 +1,28 @@ +# Labels PRs by the paths they touch. Rules: .github/labeler.yml +name: Pull Request Label + +on: + pull_request_target: # zizmor: ignore[dangerous-triggers] + types: [opened, reopened, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + label: + name: Label Pull Request + runs-on: ubuntu-slim + permissions: + contents: read + pull-requests: write + issues: write + + steps: + - name: Apply labels + uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 + with: + sync-labels: true