From 735efb4a0a50bb1a533b000483f2d0a23effbd26 Mon Sep 17 00:00:00 2001 From: Brian DeHamer Date: Tue, 17 Dec 2024 11:46:41 -0800 Subject: [PATCH 1/2] bump @actions/artifact from 2.1.11 to 2.2.0 Signed-off-by: Brian DeHamer --- .licenses/npm/@actions/artifact.dep.yml | 6 +++--- package-lock.json | 15 ++++++++------- package.json | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index 6f521cc3..f6258542 100644 --- a/.licenses/npm/@actions/artifact.dep.yml +++ b/.licenses/npm/@actions/artifact.dep.yml @@ -1,9 +1,9 @@ --- name: "@actions/artifact" -version: 2.1.11 +version: 2.2.0 type: npm -summary: -homepage: +summary: Actions artifact lib +homepage: https://github.com/actions/toolkit/tree/main/packages/artifact license: mit licenses: - sources: LICENSE.md diff --git a/package-lock.json b/package-lock.json index 45e63f89..7ca32b55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "4.4.3", "license": "MIT", "dependencies": { - "@actions/artifact": "^2.1.11", + "@actions/artifact": "^2.2.0", "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", "@actions/glob": "^0.5.0", @@ -34,9 +34,10 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.11.tgz", - "integrity": "sha512-V/N/3yM3oLxozq2dpdGqbd/39UbDOR54bF25vYsvn3QZnyZERSzPjTAAwpGzdcwESye9G7vnuhPiKQACEuBQpg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.0.tgz", + "integrity": "sha512-nDEyBsphN148zHe6ihq1a/UX92MDgC2GS9XmeFx2xs/wztZxzARYllviiP5U1nTDp2n9dEhnUig9RP9eSDcU5g==", + "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -7908,9 +7909,9 @@ }, "dependencies": { "@actions/artifact": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.11.tgz", - "integrity": "sha512-V/N/3yM3oLxozq2dpdGqbd/39UbDOR54bF25vYsvn3QZnyZERSzPjTAAwpGzdcwESye9G7vnuhPiKQACEuBQpg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.0.tgz", + "integrity": "sha512-nDEyBsphN148zHe6ihq1a/UX92MDgC2GS9XmeFx2xs/wztZxzARYllviiP5U1nTDp2n9dEhnUig9RP9eSDcU5g==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", diff --git a/package.json b/package.json index 76d272eb..5ab3210b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/actions/upload-artifact#readme", "dependencies": { - "@actions/artifact": "^2.1.11", + "@actions/artifact": "^2.2.0", "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", "@actions/glob": "^0.5.0", From c40c16d999899d3642ba1597014ba7ef8ff611e7 Mon Sep 17 00:00:00 2001 From: Brian DeHamer Date: Tue, 17 Dec 2024 11:47:09 -0800 Subject: [PATCH 2/2] add new artifact-digest output Signed-off-by: Brian DeHamer --- README.md | 1 + __tests__/upload.test.ts | 4 +++- action.yml | 3 +++ dist/merge/index.js | 4 +++- dist/upload/index.js | 4 +++- merge/README.md | 1 + merge/action.yml | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- src/shared/upload-artifact.ts | 1 + 10 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f3cce8a9..507f6e10 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ For assistance with breaking changes, see [MIGRATION.md](docs/MIGRATION.md). | - | - | - | | `artifact-id` | GitHub ID of an Artifact, can be used by the REST API | `1234` | | `artifact-url` | URL to download an Artifact. Can be used in many scenarios such as linking to artifacts in issues or pull requests. Users must be logged-in in order for this URL to work. This URL is valid as long as the artifact has not expired or the artifact, run or repository have not been deleted | `https://github.com/example-org/example-repo/actions/runs/1/artifacts/1234` | +| `artifact-digest` | SHA-256 digest of an Artifact | 0fde654d4c6e659b45783a725dc92f1bfb0baa6c2de64b34e814dc206ff4aaaf | ## Examples diff --git a/__tests__/upload.test.ts b/__tests__/upload.test.ts index 0b74e667..b7e7133f 100644 --- a/__tests__/upload.test.ts +++ b/__tests__/upload.test.ts @@ -60,7 +60,8 @@ describe('upload', () => { jest.spyOn(artifact, 'uploadArtifact').mockResolvedValue({ size: 123, - id: 1337 + id: 1337, + digest: 'facefeed' }) }) @@ -95,6 +96,7 @@ describe('upload', () => { await run() expect(core.setOutput).toHaveBeenCalledWith('artifact-id', 1337) + expect(core.setOutput).toHaveBeenCalledWith('artifact-digest', 'facefeed') expect(core.setOutput).toHaveBeenCalledWith( 'artifact-url', `${github.context.serverUrl}/${github.context.repo.owner}/${ diff --git a/action.yml b/action.yml index ef246590..2a0ecf19 100644 --- a/action.yml +++ b/action.yml @@ -61,6 +61,9 @@ outputs: This URL will be valid for as long as the artifact exists and the workflow run and repository exists. Once an artifact has expired this URL will no longer work. Common uses cases for such a download URL can be adding download links to artifacts in descriptions or comments on pull requests or issues. + artifact-digest: + description: > + SHA-256 digest for the artifact that was just uploaded. Empty if the artifact upload failed. runs: using: 'node20' main: 'dist/upload/index.js' diff --git a/dist/merge/index.js b/dist/merge/index.js index 7dfc5c77..8d9ff83e 100644 --- a/dist/merge/index.js +++ b/dist/merge/index.js @@ -3606,6 +3606,7 @@ function uploadArtifact(name, files, rootDirectory, options) { core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`); return { size: uploadResult.uploadSize, + digest: uploadResult.sha256Hash, id: Number(artifactId) }; }); @@ -127615,6 +127616,7 @@ function uploadArtifact(artifactName, filesToUpload, rootDirectory, options) { const uploadResponse = yield artifact_1.default.uploadArtifact(artifactName, filesToUpload, rootDirectory, options); core.info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`); core.setOutput('artifact-id', uploadResponse.id); + core.setOutput('artifact-digest', uploadResponse.digest); const repository = github.context.repo; const artifactURL = `${github.context.serverUrl}/${repository.owner}/${repository.repo}/actions/runs/${github.context.runId}/artifacts/${uploadResponse.id}`; core.info(`Artifact download URL: ${artifactURL}`); @@ -137604,7 +137606,7 @@ module.exports = index; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.11","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/dist/upload/index.js b/dist/upload/index.js index f861db0a..c92ff14d 100644 --- a/dist/upload/index.js +++ b/dist/upload/index.js @@ -3606,6 +3606,7 @@ function uploadArtifact(name, files, rootDirectory, options) { core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`); return { size: uploadResult.uploadSize, + digest: uploadResult.sha256Hash, id: Number(artifactId) }; }); @@ -127370,6 +127371,7 @@ function uploadArtifact(artifactName, filesToUpload, rootDirectory, options) { const uploadResponse = yield artifact_1.default.uploadArtifact(artifactName, filesToUpload, rootDirectory, options); core.info(`Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`); core.setOutput('artifact-id', uploadResponse.id); + core.setOutput('artifact-digest', uploadResponse.digest); const repository = github.context.repo; const artifactURL = `${github.context.serverUrl}/${repository.owner}/${repository.repo}/actions/runs/${github.context.runId}/artifacts/${uploadResponse.id}`; core.info(`Artifact download URL: ${artifactURL}`); @@ -137614,7 +137616,7 @@ module.exports = index; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.11","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/merge/README.md b/merge/README.md index b2f390e0..c05af96a 100644 --- a/merge/README.md +++ b/merge/README.md @@ -65,6 +65,7 @@ For most cases, this may not be the most efficient solution. See [the migration | - | - | - | | `artifact-id` | GitHub ID of an Artifact, can be used by the REST API | `1234` | | `artifact-url` | URL to download an Artifact. Can be used in many scenarios such as linking to artifacts in issues or pull requests. Users must be logged-in in order for this URL to work. This URL is valid as long as the artifact has not expired or the artifact, run or repository have not been deleted | `https://github.com/example-org/example-repo/actions/runs/1/artifacts/1234` | +| `artifact-digest` | SHA-256 digest of an Artifact | 0fde654d4c6e659b45783a725dc92f1bfb0baa6c2de64b34e814dc206ff4aaaf | ## Examples diff --git a/merge/action.yml b/merge/action.yml index 81407eea..e74d5ab3 100644 --- a/merge/action.yml +++ b/merge/action.yml @@ -57,6 +57,9 @@ outputs: This URL will be valid for as long as the artifact exists and the workflow run and repository exists. Once an artifact has expired this URL will no longer work. Common uses cases for such a download URL can be adding download links to artifacts in descriptions or comments on pull requests or issues. + artifact-digest: + description: > + SHA-256 digest for the artifact that was just uploaded. Empty if the artifact upload failed. runs: using: 'node20' main: '../dist/merge/index.js' diff --git a/package-lock.json b/package-lock.json index 7ca32b55..49d1cb20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "upload-artifact", - "version": "4.4.3", + "version": "4.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "upload-artifact", - "version": "4.4.3", + "version": "4.5.0", "license": "MIT", "dependencies": { "@actions/artifact": "^2.2.0", diff --git a/package.json b/package.json index 5ab3210b..914af160 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "upload-artifact", - "version": "4.4.3", + "version": "4.5.0", "description": "Upload an Actions Artifact in a workflow run", "main": "dist/upload/index.js", "scripts": { diff --git a/src/shared/upload-artifact.ts b/src/shared/upload-artifact.ts index e8ece241..379a39ef 100644 --- a/src/shared/upload-artifact.ts +++ b/src/shared/upload-artifact.ts @@ -19,6 +19,7 @@ export async function uploadArtifact( `Artifact ${artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}` ) core.setOutput('artifact-id', uploadResponse.id) + core.setOutput('artifact-digest', uploadResponse.digest) const repository = github.context.repo const artifactURL = `${github.context.serverUrl}/${repository.owner}/${repository.repo}/actions/runs/${github.context.runId}/artifacts/${uploadResponse.id}`