mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-23 03:48:56 +08:00
Check collaborator permissions for workflow_run events (#1590)
The write-permission gate previously only ran for issue/PR entity events. Apply it to workflow_run events as well, checking both the workflow actor and the actor recorded on the upstream run when they differ. allowed_non_write_users and the github_token override behave the same as for entity events. Document the behavior for workflow_run pipelines.
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
isPullRequestEvent,
|
||||
isPullRequestReviewEvent,
|
||||
isPullRequestReviewCommentEvent,
|
||||
isWorkflowRunEvent,
|
||||
} from "../github/context";
|
||||
import type { GitHubContext } from "../github/context";
|
||||
import { detectMode } from "../modes/detector";
|
||||
@@ -185,8 +186,10 @@ async function run() {
|
||||
process.env.GITHUB_TOKEN = githubToken;
|
||||
process.env.GH_TOKEN = githubToken;
|
||||
|
||||
// Check write permissions (only for entity contexts)
|
||||
if (isEntityContext(context)) {
|
||||
// Check write permissions for entity contexts, and for workflow_run
|
||||
// events, whose upstream run may have been started by an actor without
|
||||
// write access (e.g. the author of a fork pull request)
|
||||
if (isEntityContext(context) || isWorkflowRunEvent(context)) {
|
||||
const hasWritePermissions = await checkWritePermissions(
|
||||
octokit.rest,
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user