diff --git a/action.yml b/action.yml index b6d0f05b..ee05a529 100644 --- a/action.yml +++ b/action.yml @@ -175,7 +175,7 @@ runs: if: inputs.path_to_bun_executable == '' uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0 with: - bun-version: 1.3.6 + bun-version: 1.3.14 token: ${{ inputs.github_token || github.token }} - name: Setup Custom Bun Path diff --git a/base-action/action.yml b/base-action/action.yml index cfef22d5..0a66adea 100644 --- a/base-action/action.yml +++ b/base-action/action.yml @@ -99,7 +99,7 @@ runs: if: inputs.path_to_bun_executable == '' uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0 with: - bun-version: 1.3.6 + bun-version: 1.3.14 - name: Setup Custom Bun Path if: inputs.path_to_bun_executable != '' diff --git a/src/github/validation/actor.ts b/src/github/validation/actor.ts index 92f5ede6..c21481c6 100644 --- a/src/github/validation/actor.ts +++ b/src/github/validation/actor.ts @@ -60,9 +60,7 @@ export async function checkHumanActor( (error.message.includes("Not Found") || error.message.includes("is not a user")) ) { - const botName = githubContext.actor - .toLowerCase() - .replace(/\[bot\]$/, ""); + const botName = githubContext.actor.toLowerCase().replace(/\[bot\]$/, ""); throw new Error( `Workflow initiated by non-human actor: ${botName} (actor not found on GitHub). Add bot to allowed_bots list or use '*' to allow all bots.`, ); diff --git a/src/github/validation/permissions.ts b/src/github/validation/permissions.ts index 9ade4bd5..502db0ff 100644 --- a/src/github/validation/permissions.ts +++ b/src/github/validation/permissions.ts @@ -102,10 +102,7 @@ export async function checkWritePermissions( // Handle 404 errors for non-user actors (e.g. GitHub Apps like Copilot // whose GITHUB_ACTOR doesn't end with [bot]). // The collaborator permission API only works for user accounts. - if ( - error instanceof Error && - error.message.includes("is not a user") - ) { + if (error instanceof Error && error.message.includes("is not a user")) { core.info( `Actor ${actor} is not a GitHub user (likely a GitHub App). Checking allowed_bots...`, ); diff --git a/test/permissions.test.ts b/test/permissions.test.ts index 8b8bcc97..94aeaaf1 100644 --- a/test/permissions.test.ts +++ b/test/permissions.test.ts @@ -309,17 +309,18 @@ describe("checkWritePermissions", () => { // end with [bot] and is not a valid GitHub user, so the collaborator // permission API returns 404 with "is not a user". - const createMockOctokitThat404s = () => ({ - repos: { - getCollaboratorPermissionLevel: async () => { - const err = new Error( - "HttpError: Copilot is not a user - https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user", - ); - (err as any).status = 404; - throw err; + const createMockOctokitThat404s = () => + ({ + repos: { + getCollaboratorPermissionLevel: async () => { + const err = new Error( + "HttpError: Copilot is not a user - https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user", + ); + (err as any).status = 404; + throw err; + }, }, - }, - } as any); + }) as any; test("should return true for non-[bot] actor in allowed_bots (pre-API check)", async () => { // The allowed_bots check should happen BEFORE calling the API,