Unverified Commit b92745fe authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[ci] replace next-labeler-webhook with in-repo GitHub Action (#93080)

parent 3cb77c84
# PR Auto-Labeler
Applies labels to a pull request based on its changed files and author.
## Usage
Reference this action from its canonical location on the `canary` branch so
that all release branches share one source of truth for labeling rules:
```yaml
jobs:
label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: vercel/next.js/.github/actions/pr-auto-label@canary
```
No checkout is required — GitHub Actions fetches the action bundle
(`dist/index.js`, pinned to the ref after `@`) from this repo directly.
Referencing `@canary` means a PR targeting a release branch is still
labeled against the latest rules, matching the original
`next-labeler-webhook` behavior.
## Security model
The action is designed to run under `pull_request_target` so it can label
PRs from forks, and is hardened accordingly:
- **No inputs.** The action reads `GITHUB_TOKEN` from the environment
rather than an input, so callers can't pass an unrelated higher-scoped
token from a fork-controlled context.
- **No PR-controlled code runs.** The calling workflow does not check out
the PR, install dependencies, or execute scripts from the PR. Only the
trusted action bundle, fetched by GitHub from `@canary`, runs.
- **No PR-controlled strings are shell-interpolated.** The only
PR-derived values are `pull_request.user.login` and the changed file
list — both returned by the GitHub API, not by the PR author — and
neither is ever passed to a shell.
- **Labels are capped by config.** The action only applies labels whose
names appear as keys in `src/config.json`. Anything else is rejected
before the `addLabels` call so a buggy config can't silently create new
labels in the repo.
## Config
Labeling rules live in [`src/config.json`](src/config.json). Each label
maps to a list of rules:
- A file glob (string) — matched with `minimatch` against the PR's
changed file paths.
- An author rule (`{ "type": "user", "pattern": "<login>" }`) — matched
case-insensitively against `pull_request.user.login`.
A label is applied if any of its rules match.
## Developing
After editing `src/*.ts` or `src/config.json`, rebuild the committed
bundle:
```bash
cd .github/actions/pr-auto-label
pnpm install
pnpm build
```
Commit the regenerated `dist/index.js` alongside your source change.
name: 'PR Auto-Labeler'
description: >-
Applies labels to a pull request based on changed files and author, using
the config in this action's src/config.json.
# This action deliberately has no inputs. It reads `GITHUB_TOKEN` from the
# environment, which GitHub Actions populates with the job's own token.
# Exposing a `github-token` input would let callers pass an unrelated
# (potentially higher-privileged) token from a fork-controlled context;
# forcing the use of the job token keeps the principle of least privilege
# tied to the workflow's declared `permissions:` block.
runs:
using: 'node24'
main: 'dist/index.js'
This diff is collapsed.
This diff is collapsed.
{
"private": true,
"description": "Applies labels to a pull request based on changed files and author.",
"scripts": {
"build": "ncc build src/index.ts -m -o dist --license licenses.txt",
"types": "tsc --noEmit"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/github": "6.0.0",
"minimatch": "^9.0.9",
"typescript": "6.0.2"
},
"devDependencies": {
"@vercel/ncc": "^0.38.3"
}
}
import { info, setFailed, warning } from '@actions/core'
import { context, getOctokit } from '@actions/github'
import { minimatch } from 'minimatch'
import config from './config.json'
type AuthorRule = { type: 'user'; pattern: string }
type LabelRule = string | AuthorRule
type LabelerConfig = { labels: Record<string, LabelRule[]> }
function isAuthorRule(rule: LabelRule): rule is AuthorRule {
return (
typeof rule === 'object' &&
rule !== null &&
'type' in rule &&
rule.type === 'user'
)
}
/**
* Compute the set of labels to apply for a pull request.
*/
export function computeLabels(
config: LabelerConfig,
author: string,
changedFiles: string[]
): string[] {
const matched = new Set<string>()
for (const [label, rules] of Object.entries(config.labels)) {
for (const rule of rules) {
if (isAuthorRule(rule)) {
if (rule.pattern.toLowerCase() === author.toLowerCase()) {
matched.add(label)
break
}
} else if (typeof rule === 'string') {
const matches = changedFiles.some((file) =>
minimatch(file, rule, { dot: true, matchBase: false })
)
if (matches) {
matched.add(label)
break
}
} else {
warning(
`Unknown rule type for label "${label}": ${JSON.stringify(rule)}`
)
}
}
}
return Array.from(matched)
}
async function main() {
// Read the token strictly from the environment so a caller can't pass an
// unrelated higher-privileged token via an action input.
const token = process.env.GITHUB_TOKEN
if (!token) {
throw new TypeError(
'GITHUB_TOKEN is not set. Ensure the calling workflow grants `pull-requests: write`.'
)
}
const pr = context.payload.pull_request
if (!pr) {
info('No pull_request payload present; skipping.')
return
}
const { owner, repo } = context.repo
const prNumber: number = pr.number
const author: string | undefined = pr.user?.login
if (!author) {
warning('Pull request has no author login; skipping.')
return
}
const octokit = getOctokit(token)
const changedFiles: string[] = await octokit.paginate(
octokit.rest.pulls.listFiles,
{ owner, repo, pull_number: prNumber, per_page: 100 },
(response) => response.data.map((f) => f.filename)
)
info(`PR #${prNumber} author: ${author}`)
info(`PR #${prNumber} changed files: ${changedFiles.length}`)
const allowedLabels = new Set(Object.keys((config as LabelerConfig).labels))
const labelsToAdd = computeLabels(
config as LabelerConfig,
author,
changedFiles
).filter((label) => {
// Defense in depth: `addLabels` will create missing labels on the fly,
// so ensure the set we send is always a subset of the config's keys.
// `computeLabels` already enforces this, but an explicit filter here
// keeps the invariant local to the API call.
if (!allowedLabels.has(label)) {
warning(`Skipping unknown label "${label}" not declared in config.`)
return false
}
return true
})
if (labelsToAdd.length === 0) {
info('No labels matched.')
return
}
info(`Applying labels: ${labelsToAdd.join(', ')}`)
try {
await octokit.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels: labelsToAdd,
})
} catch (error) {
setFailed(
`Failed to apply labels to PR #${prNumber}: ${
error instanceof Error ? (error.stack ?? error.message) : String(error)
}`
)
}
}
main().catch((error) => {
setFailed(
error instanceof Error ? (error.stack ?? error.message) : String(error)
)
})
{
"compilerOptions": {
"target": "es2024",
"module": "preserve",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"rootDir": "./src",
"strict": true,
"skipLibCheck": false
},
"files": ["./src/index.ts"]
}
...@@ -3,6 +3,7 @@ lockfileVersion: '9.0' ...@@ -3,6 +3,7 @@ lockfileVersion: '9.0'
settings: settings:
autoInstallPeers: true autoInstallPeers: true
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
injectWorkspacePackages: true
importers: importers:
...@@ -75,7 +76,7 @@ importers: ...@@ -75,7 +76,7 @@ importers:
version: 7.8.0 version: 7.8.0
ai: ai:
specifier: ^3.4.14 specifier: ^3.4.14
version: 3.4.33(react@19.0.0)(sswr@2.2.0(svelte@5.46.1))(svelte@5.46.1)(vue@3.5.26(typescript@5.7.2))(zod@3.25.76) version: 3.4.33(react@19.0.0)(sswr@2.2.0(svelte@5.46.1))(svelte@5.46.1)(vue@3.5.26(typescript@6.0.2))(zod@3.25.76)
slack-block-builder: slack-block-builder:
specifier: ^2.8.0 specifier: ^2.8.0
version: 2.8.0 version: 2.8.0
...@@ -130,6 +131,25 @@ importers: ...@@ -130,6 +131,25 @@ importers:
specifier: 5.1.6 specifier: 5.1.6
version: 5.1.6 version: 5.1.6
actions/pr-auto-label:
dependencies:
'@actions/core':
specifier: ^1.11.1
version: 1.11.1
'@actions/github':
specifier: 6.0.0
version: 6.0.0
minimatch:
specifier: ^9.0.9
version: 9.0.9
typescript:
specifier: 6.0.2
version: 6.0.2
devDependencies:
'@vercel/ncc':
specifier: ^0.38.3
version: 0.38.3
actions/upload-turboyet-data: actions/upload-turboyet-data:
dependencies: dependencies:
'@vercel/kv': '@vercel/kv':
...@@ -197,9 +217,6 @@ packages: ...@@ -197,9 +217,6 @@ packages:
'@actions/github@6.0.0': '@actions/github@6.0.0':
resolution: {integrity: sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==} resolution: {integrity: sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==}
'@actions/http-client@2.2.0':
resolution: {integrity: sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==}
'@actions/http-client@2.2.3': '@actions/http-client@2.2.3':
resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==} resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==}
...@@ -303,10 +320,6 @@ packages: ...@@ -303,10 +320,6 @@ packages:
resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@fastify/busboy@2.1.0':
resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==}
engines: {node: '>=14'}
'@fastify/busboy@2.1.1': '@fastify/busboy@2.1.1':
resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
engines: {node: '>=14'} engines: {node: '>=14'}
...@@ -559,6 +572,9 @@ packages: ...@@ -559,6 +572,9 @@ packages:
brace-expansion@1.1.12: brace-expansion@1.1.12:
resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==} resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==}
brace-expansion@2.1.0:
resolution: {integrity: sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==}
ccount@1.1.0: ccount@1.1.0:
resolution: {integrity: sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==} resolution: {integrity: sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==}
...@@ -854,6 +870,10 @@ packages: ...@@ -854,6 +870,10 @@ packages:
minimatch@3.1.2: minimatch@3.1.2:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
minimatch@9.0.9:
resolution: {integrity: sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==}
engines: {node: '>=16 || 14 >=14.17'}
nanoid@3.3.11: nanoid@3.3.11:
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
...@@ -1119,18 +1139,14 @@ packages: ...@@ -1119,18 +1139,14 @@ packages:
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
typescript@5.7.2: typescript@6.0.2:
resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==}
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
undici-types@5.26.5: undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
undici@5.28.2:
resolution: {integrity: sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==}
engines: {node: '>=14.0'}
undici@5.28.4: undici@5.28.4:
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==} resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
engines: {node: '>=14.0'} engines: {node: '>=14.0'}
...@@ -1271,16 +1287,11 @@ snapshots: ...@@ -1271,16 +1287,11 @@ snapshots:
'@actions/github@6.0.0': '@actions/github@6.0.0':
dependencies: dependencies:
'@actions/http-client': 2.2.0 '@actions/http-client': 2.2.3
'@octokit/core': 5.0.2 '@octokit/core': 5.0.2
'@octokit/plugin-paginate-rest': 9.1.5(@octokit/core@5.0.2) '@octokit/plugin-paginate-rest': 9.1.5(@octokit/core@5.0.2)
'@octokit/plugin-rest-endpoint-methods': 10.2.0(@octokit/core@5.0.2) '@octokit/plugin-rest-endpoint-methods': 10.2.0(@octokit/core@5.0.2)
'@actions/http-client@2.2.0':
dependencies:
tunnel: 0.0.6
undici: 5.28.2
'@actions/http-client@2.2.3': '@actions/http-client@2.2.3':
dependencies: dependencies:
tunnel: 0.0.6 tunnel: 0.0.6
...@@ -1357,13 +1368,13 @@ snapshots: ...@@ -1357,13 +1368,13 @@ snapshots:
optionalDependencies: optionalDependencies:
zod: 3.25.76 zod: 3.25.76
'@ai-sdk/vue@0.0.59(vue@3.5.26(typescript@5.7.2))(zod@3.25.76)': '@ai-sdk/vue@0.0.59(vue@3.5.26(typescript@6.0.2))(zod@3.25.76)':
dependencies: dependencies:
'@ai-sdk/provider-utils': 1.0.22(zod@3.25.76) '@ai-sdk/provider-utils': 1.0.22(zod@3.25.76)
'@ai-sdk/ui-utils': 0.0.50(zod@3.25.76) '@ai-sdk/ui-utils': 0.0.50(zod@3.25.76)
swrv: 1.1.0(vue@3.5.26(typescript@5.7.2)) swrv: 1.1.0(vue@3.5.26(typescript@6.0.2))
optionalDependencies: optionalDependencies:
vue: 3.5.26(typescript@5.7.2) vue: 3.5.26(typescript@6.0.2)
transitivePeerDependencies: transitivePeerDependencies:
- zod - zod
...@@ -1380,8 +1391,6 @@ snapshots: ...@@ -1380,8 +1391,6 @@ snapshots:
'@babel/helper-string-parser': 7.27.1 '@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5 '@babel/helper-validator-identifier': 7.28.5
'@fastify/busboy@2.1.0': {}
'@fastify/busboy@2.1.1': {} '@fastify/busboy@2.1.1': {}
'@jridgewell/gen-mapping@0.3.13': '@jridgewell/gen-mapping@0.3.13':
...@@ -1630,17 +1639,17 @@ snapshots: ...@@ -1630,17 +1639,17 @@ snapshots:
'@vue/shared': 3.5.26 '@vue/shared': 3.5.26
csstype: 3.2.3 csstype: 3.2.3
'@vue/server-renderer@3.5.26(vue@3.5.26(typescript@5.7.2))': '@vue/server-renderer@3.5.26(vue@3.5.26(typescript@6.0.2))':
dependencies: dependencies:
'@vue/compiler-ssr': 3.5.26 '@vue/compiler-ssr': 3.5.26
'@vue/shared': 3.5.26 '@vue/shared': 3.5.26
vue: 3.5.26(typescript@5.7.2) vue: 3.5.26(typescript@6.0.2)
'@vue/shared@3.5.26': {} '@vue/shared@3.5.26': {}
acorn@8.15.0: {} acorn@8.15.0: {}
ai@3.4.33(react@19.0.0)(sswr@2.2.0(svelte@5.46.1))(svelte@5.46.1)(vue@3.5.26(typescript@5.7.2))(zod@3.25.76): ai@3.4.33(react@19.0.0)(sswr@2.2.0(svelte@5.46.1))(svelte@5.46.1)(vue@3.5.26(typescript@6.0.2))(zod@3.25.76):
dependencies: dependencies:
'@ai-sdk/provider': 0.0.26 '@ai-sdk/provider': 0.0.26
'@ai-sdk/provider-utils': 1.0.22(zod@3.25.76) '@ai-sdk/provider-utils': 1.0.22(zod@3.25.76)
...@@ -1648,7 +1657,7 @@ snapshots: ...@@ -1648,7 +1657,7 @@ snapshots:
'@ai-sdk/solid': 0.0.54(zod@3.25.76) '@ai-sdk/solid': 0.0.54(zod@3.25.76)
'@ai-sdk/svelte': 0.0.57(svelte@5.46.1)(zod@3.25.76) '@ai-sdk/svelte': 0.0.57(svelte@5.46.1)(zod@3.25.76)
'@ai-sdk/ui-utils': 0.0.50(zod@3.25.76) '@ai-sdk/ui-utils': 0.0.50(zod@3.25.76)
'@ai-sdk/vue': 0.0.59(vue@3.5.26(typescript@5.7.2))(zod@3.25.76) '@ai-sdk/vue': 0.0.59(vue@3.5.26(typescript@6.0.2))(zod@3.25.76)
'@opentelemetry/api': 1.9.0 '@opentelemetry/api': 1.9.0
eventsource-parser: 1.1.2 eventsource-parser: 1.1.2
json-schema: 0.4.0 json-schema: 0.4.0
...@@ -1697,6 +1706,10 @@ snapshots: ...@@ -1697,6 +1706,10 @@ snapshots:
balanced-match: 1.0.2 balanced-match: 1.0.2
concat-map: 0.0.1 concat-map: 0.0.1
brace-expansion@2.1.0:
dependencies:
balanced-match: 1.0.2
ccount@1.1.0: {} ccount@1.1.0: {}
chalk@5.3.0: {} chalk@5.3.0: {}
...@@ -1991,6 +2004,10 @@ snapshots: ...@@ -1991,6 +2004,10 @@ snapshots:
dependencies: dependencies:
brace-expansion: 1.1.12 brace-expansion: 1.1.12
minimatch@9.0.9:
dependencies:
brace-expansion: 2.1.0
nanoid@3.3.11: {} nanoid@3.3.11: {}
nanoid@3.3.6: {} nanoid@3.3.6: {}
...@@ -2199,9 +2216,9 @@ snapshots: ...@@ -2199,9 +2216,9 @@ snapshots:
swrev@4.0.0: {} swrev@4.0.0: {}
swrv@1.1.0(vue@3.5.26(typescript@5.7.2)): swrv@1.1.0(vue@3.5.26(typescript@6.0.2)):
dependencies: dependencies:
vue: 3.5.26(typescript@5.7.2) vue: 3.5.26(typescript@6.0.2)
throttleit@2.1.0: {} throttleit@2.1.0: {}
...@@ -2221,15 +2238,10 @@ snapshots: ...@@ -2221,15 +2238,10 @@ snapshots:
typescript@5.1.6: {} typescript@5.1.6: {}
typescript@5.7.2: typescript@6.0.2: {}
optional: true
undici-types@5.26.5: {} undici-types@5.26.5: {}
undici@5.28.2:
dependencies:
'@fastify/busboy': 2.1.0
undici@5.28.4: undici@5.28.4:
dependencies: dependencies:
'@fastify/busboy': 2.1.1 '@fastify/busboy': 2.1.1
...@@ -2309,15 +2321,15 @@ snapshots: ...@@ -2309,15 +2321,15 @@ snapshots:
unist-util-stringify-position: 2.0.3 unist-util-stringify-position: 2.0.3
vfile-message: 2.0.4 vfile-message: 2.0.4
vue@3.5.26(typescript@5.7.2): vue@3.5.26(typescript@6.0.2):
dependencies: dependencies:
'@vue/compiler-dom': 3.5.26 '@vue/compiler-dom': 3.5.26
'@vue/compiler-sfc': 3.5.26 '@vue/compiler-sfc': 3.5.26
'@vue/runtime-dom': 3.5.26 '@vue/runtime-dom': 3.5.26
'@vue/server-renderer': 3.5.26(vue@3.5.26(typescript@5.7.2)) '@vue/server-renderer': 3.5.26(vue@3.5.26(typescript@6.0.2))
'@vue/shared': 3.5.26 '@vue/shared': 3.5.26
optionalDependencies: optionalDependencies:
typescript: 5.7.2 typescript: 6.0.2
web-namespaces@1.1.4: {} web-namespaces@1.1.4: {}
......
name: Pull Request Auto-Labeler
# Runs on pull_request_target so the workflow has the permissions of the
# base repository and can write labels on PRs opened from forks.
#
# `pull_request_target` is only risky when a workflow holding a
# write-scoped token also executes PR-controlled content — e.g. checking
# out the PR head and running its build/install scripts, or interpolating
# PR text (titles, bodies, branch names) directly into shell commands.
# This workflow does neither:
#
# 1. The action is referenced as `vercel/next.js/.github/actions/
# pr-auto-label@canary`, so GitHub Actions fetches the action bundle
# (with the labeler config inlined into it at build time) directly
# from the `canary` ref of this repo — independent of the PR's
# source or target branch. A fork PR cannot influence which code
# runs here. Pinning to `canary` (rather than the PR's base ref)
# also preserves the original `next-labeler-webhook` semantics:
# PRs targeting release branches are still labeled using the
# current canary rules.
# 2. No PR-controlled code executes on the runner. We don't check out
# the PR, run `pnpm install` / `npm install`, or execute any script
# defined by the PR's `package.json`.
# 3. No PR-controlled text is interpolated into `run:` scripts. The
# action reads `pull_request.user.login` and the list of changed
# files via the GitHub API — both authenticated by GitHub and not
# forgeable by the PR author — and passes them to the `octokit`
# client, not to a shell.
# 4. `permissions` is scoped to the minimum needed: `pull-requests:
# write` to apply labels.
# 5. `if: github.repository_owner == 'vercel'` prevents the workflow
# from running in unrelated forks of this repo.
#
# If you ever change this workflow to check out the PR head, install
# dependencies from the PR, or interpolate PR-provided strings into a
# shell command, revisit this threat model.
on:
pull_request_target:
# `opened` covers new PRs (including drafts) and `synchronize` covers
# every subsequent push. Other lifecycle events (`reopened`,
# `ready_for_review`, `edited`) don't change the file list or the
# author, so there's nothing new to label.
types: [opened, synchronize]
# Deny-by-default at the workflow level. The job below opts back in to
# `pull-requests: write` — the minimum needed to apply labels.
permissions: {}
concurrency:
# `github.event.pull_request.number` is always set for
# `pull_request_target`, but fall back to the run ID if this workflow is
# ever extended to run on other events, to avoid collapsing unrelated
# runs into the same group.
group: pr-auto-label-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
label:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: vercel/next.js/.github/actions/pr-auto-label@canary
...@@ -20,7 +20,7 @@ const CHANGE_ITEM_GROUPS = { ...@@ -20,7 +20,7 @@ const CHANGE_ITEM_GROUPS = {
'CODE_OF_CONDUCT.md', 'CODE_OF_CONDUCT.md',
'readme.md', 'readme.md',
'.github/ISSUE_TEMPLATE', '.github/ISSUE_TEMPLATE',
'.github/labeler.json', '.github/actions/pr-auto-label/src/config.json',
'.github/pull_request_template.md', '.github/pull_request_template.md',
'packages/next-plugin-storybook/readme.md', 'packages/next-plugin-storybook/readme.md',
'packages/next/license.md', 'packages/next/license.md',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment