From eb9aade5caadbcc25add108ec4bb0a2c7238e9b1 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Tue, 22 Mar 2022 12:06:55 -0700 Subject: [PATCH] add runAttempt to s3Prefix Signed-off-by: Eli Uriegas --- dist/index.js | 4 +++- package-lock.json | 1 + package.json | 1 + src/download-artifact.ts | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5be667a..6f7109b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31197,7 +31197,9 @@ function run() { } core.debug(`Resolved path is ${resolvedPath}`); const s3 = new AWS.S3({ region: region }); - const s3Prefix = `${github.context.repo.owner}/${github.context.repo.repo}/${github.context.runId}/${name}/`; + // TODO: This is a temporary bandaid, see https://github.com/actions/toolkit/pull/1027 + const runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10); + const s3Prefix = `${github.context.repo.owner}/${github.context.repo.repo}/${github.context.runId}/${runAttempt}/${name}/`; const s3Params = { Bucket: s3Bucket, Prefix: s3Prefix diff --git a/package-lock.json b/package-lock.json index cfa84ae..d6f65a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "download-artifact", "version": "2.0.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index b7caf73..d0b0f0b 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Download a build artifact that was previously uploaded in the workflow by the upload-artifact action", "main": "dist/index.js", "scripts": { + "all": "npm run format && npm run build && npm run release", "build": "tsc", "release": "ncc build src/download-artifact.ts", "check-all": "concurrently \"npm:format-check\" \"npm:lint\" \"npm:build\"", diff --git a/src/download-artifact.ts b/src/download-artifact.ts index f21c2ff..0311ad4 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -40,7 +40,9 @@ async function run(): Promise { } core.debug(`Resolved path is ${resolvedPath}`) const s3 = new AWS.S3({region: region}) - const s3Prefix = `${github.context.repo.owner}/${github.context.repo.repo}/${github.context.runId}/${name}/` + // TODO: This is a temporary bandaid, see https://github.com/actions/toolkit/pull/1027 + const runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT as string, 10) + const s3Prefix = `${github.context.repo.owner}/${github.context.repo.repo}/${github.context.runId}/${runAttempt}/${name}/` const s3Params = { Bucket: s3Bucket, Prefix: s3Prefix