Skip to content

Commit ebb69bb

Browse files
authored
fix: support pull_request_target event in autolabeler (#1560)
* fix: support pull_request_target event in autolabeler Fixes #1559 ## What Added pull_request_target as an accepted event type in the autolabeler event validation check. ## Why The autolabeler only accepted pull_request events, but pull_request_target is required for workflows that need write permissions to label PRs from forks. The payload shape is identical between both events, so no other code changes are needed. ## Notes - The v6 release-drafter action supported pull_request_target when used with disable-releaser: true; this restores that capability for the v7 autolabeler sub-action Signed-off-by: jmeridth <[email protected]> * fix: run npm run all after PR feedback Signed-off-by: jmeridth <[email protected]> --------- Signed-off-by: jmeridth <[email protected]>
1 parent bddbd54 commit ebb69bb

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

dist/actions/autolabeler/run.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"zod": "^4.3.6"
5555
},
5656
"devDependencies": {
57-
"@biomejs/biome": "^2.4.6",
57+
"@biomejs/biome": "2.4.6",
5858
"@graphql-codegen/cli": "^6.2.1",
5959
"@graphql-codegen/near-operation-file-preset": "^5.0.0",
6060
"@octokit/webhooks-types": "^7.6.1",

src/actions/autolabeler/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ export const main = async (params: {
1313
`Running for event "${context.eventName || '[undefined]'}.${context.payload.action || '[undefined]'}"`,
1414
)
1515

16-
if (context.eventName !== 'pull_request') {
16+
if (
17+
context.eventName !== 'pull_request' &&
18+
context.eventName !== 'pull_request_target'
19+
) {
1720
throw new Error(
18-
`Event type is wrong. Expected 'pull_request', received '${context.eventName}'`,
21+
`Event type is wrong. Expected 'pull_request' or 'pull_request_target', received '${context.eventName}'`,
1922
)
2023
}
2124
const octokit = getOctokit()

src/types/github.graphql.generated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ export type BulkSponsorship = {
16781678
};
16791679

16801680
/** Types that can represent a repository ruleset bypass actor. */
1681-
export type BypassActor = App | Team;
1681+
export type BypassActor = App | Team | User;
16821682

16831683
/** A user, team, or app who has the ability to bypass a force push requirement on a protected branch. */
16841684
export type BypassForcePushAllowance = Node & {

0 commit comments

Comments
 (0)