From bfdbdb71b2119384df6addd4171b242c86f2be52 Mon Sep 17 00:00:00 2001 From: Glen Date: Wed, 2 Sep 2026 20:06:13 +0200 Subject: [PATCH] fix: only chmod the nitro binary right after extracting it --- src/index.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0853a83..547c142 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,14 +82,18 @@ export async function installNitro(version: string) { : await tc.extractZip(downloadPath); toolPath = await tc.cacheDir(extractPath, toolName, version); + + // Only the freshly extracted binary is marked executable. A binary that is + // already in the tool cache was installed by an earlier job, possibly as a + // different user (a job container runs as root), and chmod on a file owned + // by another user fails with EPERM. + if (osType !== "win") { + const binaryPath = path.join(toolPath, binaryName); + await exec.exec("chmod", ["+x", binaryPath]); + } } core.addPath(toolPath); - - if (osType !== "win") { - const binaryPath = path.join(toolPath, binaryName); - await exec.exec("chmod", ["+x", binaryPath]); - } } export function getSourceMetadata(jobId?: string) {