From 355659bff273563439cd7fd7dfd81595a30e1f33 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Wed, 10 Jan 2024 15:15:52 -0500 Subject: [PATCH 01/12] clarify log messages when using pattern/merge-multiple params --- src/download-artifact.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/download-artifact.ts b/src/download-artifact.ts index 8ae890f..aedfe12 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -75,10 +75,6 @@ async function run(): Promise { artifacts = [targetArtifact] } else { - core.info( - `No input name specified, downloading all artifacts. Extra directory with the artifact name will be created for each download` - ) - const listArtifactResponse = await artifactClient.listArtifacts({ latest: true, ...options @@ -94,6 +90,15 @@ async function run(): Promise { core.debug( `Filtered from ${listArtifactResponse.artifacts.length} to ${artifacts.length} artifacts` ) + } else { + core.info( + 'No input name or pattern filtered specified, downloading all artifacts' + ) + if (!inputs.mergeMultiple) { + core.info( + 'An extra directory with the artifact name will be created for each download' + ) + } } } From a244de5a621ac562efb2450e88968f4ad7c5a877 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Wed, 10 Jan 2024 15:17:47 -0500 Subject: [PATCH 02/12] ncc --- dist/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index d796fc9..fc7187a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -121113,7 +121113,6 @@ function run() { artifacts = [targetArtifact]; } else { - core.info(`No input name specified, downloading all artifacts. Extra directory with the artifact name will be created for each download`); const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options)); artifacts = listArtifactResponse.artifacts; core.debug(`Found ${artifacts.length} artifacts in run`); @@ -121123,6 +121122,12 @@ function run() { artifacts = artifacts.filter(artifact => matcher.match(artifact.name)); core.debug(`Filtered from ${listArtifactResponse.artifacts.length} to ${artifacts.length} artifacts`); } + else { + core.info('No input name or pattern filtered specified, downloading all artifacts'); + if (!inputs.mergeMultiple) { + core.info('An extra directory with the artifact name will be created for each download'); + } + } } if (artifacts.length) { core.info(`Preparing to download the following artifacts:`); From 1de464352cdcac2b5838c0c1bb78bb3424a51953 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Wed, 31 Jan 2024 12:36:02 -0500 Subject: [PATCH 03/12] Sync migration docs with upload-artifact We've updated them quite a bit in upload-artifact so let's make sure we're consistent. --- docs/MIGRATION.md | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index 7a7ad25..b31dc26 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -2,6 +2,8 @@ - [Migration](#migration) - [Multiple uploads to the same named Artifact](#multiple-uploads-to-the-same-named-artifact) + - [Overwriting an Artifact](#overwriting-an-artifact) + - [Merging multiple artifacts](#merging-multiple-artifacts) Several behavioral differences exist between Artifact actions `v3` and below vs `v4`. This document outlines common scenarios in `v3`, and how they would be handled in `v4`. @@ -31,6 +33,7 @@ jobs: - name: Download All Artifacts uses: actions/download-artifact@v3 with: + name: my-artifact path: my-artifact - run: ls -R my-artifact ``` @@ -71,6 +74,7 @@ jobs: - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: +- name: my-artifact path: my-artifact + pattern: my-artifact-* + merge-multiple: true @@ -78,3 +82,127 @@ jobs: ``` In `v4`, the new `pattern:` input will filter the downloaded Artifacts to match the name specified. The new `merge-multiple:` input will support downloading multiple Artifacts to the same directory. If the files within the Artifacts have the same name, the last writer wins. + +## Overwriting an Artifact + +In `v3`, the contents of an Artifact were mutable so something like the following was possible: + +```yaml +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Create a file + run: echo "hello world" > my-file.txt + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: my-artifact # NOTE: same artifact name + path: my-file.txt + upload-again: + needs: upload + runs-on: ubuntu-latest + steps: + - name: Create a different file + run: echo "goodbye world" > my-file.txt + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: my-artifact # NOTE: same artifact name + path: my-file.txt +``` + +The resulting `my-file.txt` in `my-artifact` will have "goodbye world" as the content. + +In `v4`, Artifacts are immutable unless deleted. To achieve this same behavior, you can use `overwrite: true` to delete the Artifact before a new one is created: + +```diff +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Create a file + run: echo "hello world" > my-file.txt + - name: Upload Artifact +- uses: actions/upload-artifact@v3 ++ uses: actions/upload-artifact@v4 + with: + name: my-artifact # NOTE: same artifact name + path: my-file.txt + upload-again: + needs: upload + runs-on: ubuntu-latest + steps: + - name: Create a different file + run: echo "goodbye world" > my-file.txt + - name: Upload Artifact +- uses: actions/upload-artifact@v3 ++ uses: actions/upload-artifact@v4 + with: + name: my-artifact # NOTE: same artifact name + path: my-file.txt ++ overwrite: true +``` + +Note that this will create an _entirely_ new Artifact, with a different ID from the previous. + +## Merging multiple artifacts + +In `v3`, multiple uploads from multiple jobs could be done to the same Artifact. This would result in a single archive, which could be useful for sending to upstream systems outside of Actions via API or UI downloads. + +```yaml +jobs: + upload: + strategy: + matrix: + runs-on: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.runs-on }} + steps: + - name: Create a File + run: echo "hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: all-my-files # NOTE: same artifact name + path: file-${{ matrix.runs-on }}.txt +``` + +The single `all-my-files` artifact would contain the following: + +``` +. + ∟ file-ubuntu-latest.txt + ∟ file-macos-latest.txt + ∟ file-windows-latest.txt +``` + +To achieve the same in `v4` you can change it like so: + +```diff +jobs: + upload: + strategy: + matrix: + runs-on: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.runs-on }} + steps: + - name: Create a File + run: echo "hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: +- name: all-my-files ++ name: my-artifact-${{ matrix.runs-on }} + path: file-${{ matrix.runs-on }}.txt ++ merge: ++ runs-on: ubuntu-latest ++ needs: upload ++ steps: ++ - name: Merge Artifacts ++ uses: actions/upload-artifact/merge@v4 ++ with: ++ name: all-my-files ++ pattern: my-artifact-* +``` + +Note that this will download all artifacts to a temporary directory and reupload them as a single artifact. For more information on inputs and other use cases for `actions/upload-artifact/merge@v4`, see [the action documentation](../merge/README.md). From 9ac5cad9e2799348da3b2da75c8fbfa73ab3011c Mon Sep 17 00:00:00 2001 From: eggyhead <28715808+eggyhead@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:25:55 +0000 Subject: [PATCH 04/12] updating artifact dependency to version 2.1.1 --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23a4dae..6df9b30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "4.0.1", "license": "MIT", "dependencies": { - "@actions/artifact": "^2.0.1", + "@actions/artifact": "^2.1.1", "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", "minimatch": "^9.0.3" @@ -36,9 +36,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.0.1.tgz", - "integrity": "sha512-MGgWRU4n4yoGQ5NbfwKWl3whSuFG/ll2FZ1au+jAiOIykKk+dnTFMuiklomsD6yx56ZnkQTVa/0Se5N0T0f6Nw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", + "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -5862,9 +5862,9 @@ "dev": true }, "@actions/artifact": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.0.1.tgz", - "integrity": "sha512-MGgWRU4n4yoGQ5NbfwKWl3whSuFG/ll2FZ1au+jAiOIykKk+dnTFMuiklomsD6yx56ZnkQTVa/0Se5N0T0f6Nw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", + "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", diff --git a/package.json b/package.json index 819c77c..7bc5f80 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "homepage": "https://github.com/actions/download-artifact#readme", "dependencies": { - "@actions/artifact": "^2.0.1", + "@actions/artifact": "^2.1.1", "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", "minimatch": "^9.0.3" From 81eafdc926c95ab3a46553696557fe28c599a41a Mon Sep 17 00:00:00 2001 From: eggyhead <28715808+eggyhead@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:53:17 +0000 Subject: [PATCH 05/12] update artifact license --- .licenses/npm/@actions/artifact.dep.yml | 2 +- dist/index.js | 340 +++++++++++++++++++++++- 2 files changed, 335 insertions(+), 7 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index c7e75a7..bc59d55 100644 --- a/.licenses/npm/@actions/artifact.dep.yml +++ b/.licenses/npm/@actions/artifact.dep.yml @@ -1,6 +1,6 @@ --- name: "@actions/artifact" -version: 2.0.1 +version: 2.1.1 type: npm summary: homepage: diff --git a/dist/index.js b/dist/index.js index fc7187a..bd49f47 100644 --- a/dist/index.js +++ b/dist/index.js @@ -824,7 +824,7 @@ __exportStar(__nccwpck_require__(63077), exports); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ArtifactService = exports.GetSignedArtifactURLResponse = exports.GetSignedArtifactURLRequest = exports.ListArtifactsResponse_MonolithArtifact = exports.ListArtifactsResponse = exports.ListArtifactsRequest = exports.FinalizeArtifactResponse = exports.FinalizeArtifactRequest = exports.CreateArtifactResponse = exports.CreateArtifactRequest = void 0; +exports.ArtifactService = exports.DeleteArtifactResponse = exports.DeleteArtifactRequest = exports.GetSignedArtifactURLResponse = exports.GetSignedArtifactURLRequest = exports.ListArtifactsResponse_MonolithArtifact = exports.ListArtifactsResponse = exports.ListArtifactsRequest = exports.FinalizeArtifactResponse = exports.FinalizeArtifactRequest = exports.CreateArtifactResponse = exports.CreateArtifactRequest = void 0; // @generated by protobuf-ts 2.9.1 with parameter long_type_string,client_none,generate_dependencies // @generated from protobuf file "results/api/v1/artifact.proto" (package "github.actions.results.api.v1", syntax proto3) // tslint:disable @@ -1400,6 +1400,121 @@ class GetSignedArtifactURLResponse$Type extends runtime_5.MessageType { * @generated MessageType for protobuf message github.actions.results.api.v1.GetSignedArtifactURLResponse */ exports.GetSignedArtifactURLResponse = new GetSignedArtifactURLResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DeleteArtifactRequest$Type extends runtime_5.MessageType { + constructor() { + super("github.actions.results.api.v1.DeleteArtifactRequest", [ + { no: 1, name: "workflow_run_backend_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "workflow_job_run_backend_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value) { + const message = { workflowRunBackendId: "", workflowJobRunBackendId: "", name: "" }; + globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + (0, runtime_3.reflectionMergePartial)(this, message, value); + return message; + } + internalBinaryRead(reader, length, options, target) { + let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string workflow_run_backend_id */ 1: + message.workflowRunBackendId = reader.string(); + break; + case /* string workflow_job_run_backend_id */ 2: + message.workflowJobRunBackendId = reader.string(); + break; + case /* string name */ 3: + message.name = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message, writer, options) { + /* string workflow_run_backend_id = 1; */ + if (message.workflowRunBackendId !== "") + writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.workflowRunBackendId); + /* string workflow_job_run_backend_id = 2; */ + if (message.workflowJobRunBackendId !== "") + writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.workflowJobRunBackendId); + /* string name = 3; */ + if (message.name !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.name); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteArtifactRequest + */ +exports.DeleteArtifactRequest = new DeleteArtifactRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DeleteArtifactResponse$Type extends runtime_5.MessageType { + constructor() { + super("github.actions.results.api.v1.DeleteArtifactResponse", [ + { no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 2, name: "artifact_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ } + ]); + } + create(value) { + const message = { ok: false, artifactId: "0" }; + globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + (0, runtime_3.reflectionMergePartial)(this, message, value); + return message; + } + internalBinaryRead(reader, length, options, target) { + let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool ok */ 1: + message.ok = reader.bool(); + break; + case /* int64 artifact_id */ 2: + message.artifactId = reader.int64().toString(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message, writer, options) { + /* bool ok = 1; */ + if (message.ok !== false) + writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); + /* int64 artifact_id = 2; */ + if (message.artifactId !== "0") + writer.tag(2, runtime_1.WireType.Varint).int64(message.artifactId); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteArtifactResponse + */ +exports.DeleteArtifactResponse = new DeleteArtifactResponse$Type(); /** * @generated ServiceType for protobuf service github.actions.results.api.v1.ArtifactService */ @@ -1407,7 +1522,8 @@ exports.ArtifactService = new runtime_rpc_1.ServiceType("github.actions.results. { name: "CreateArtifact", options: {}, I: exports.CreateArtifactRequest, O: exports.CreateArtifactResponse }, { name: "FinalizeArtifact", options: {}, I: exports.FinalizeArtifactRequest, O: exports.FinalizeArtifactResponse }, { name: "ListArtifacts", options: {}, I: exports.ListArtifactsRequest, O: exports.ListArtifactsResponse }, - { name: "GetSignedArtifactURL", options: {}, I: exports.GetSignedArtifactURLRequest, O: exports.GetSignedArtifactURLResponse } + { name: "GetSignedArtifactURL", options: {}, I: exports.GetSignedArtifactURLRequest, O: exports.GetSignedArtifactURLResponse }, + { name: "DeleteArtifact", options: {}, I: exports.DeleteArtifactRequest, O: exports.DeleteArtifactResponse } ]); //# sourceMappingURL=artifact.js.map @@ -1438,6 +1554,7 @@ class ArtifactServiceClientJSON { this.FinalizeArtifact.bind(this); this.ListArtifacts.bind(this); this.GetSignedArtifactURL.bind(this); + this.DeleteArtifact.bind(this); } CreateArtifact(request) { const data = artifact_1.CreateArtifactRequest.toJson(request, { @@ -1477,6 +1594,16 @@ class ArtifactServiceClientJSON { ignoreUnknownFields: true, })); } + DeleteArtifact(request) { + const data = artifact_1.DeleteArtifactRequest.toJson(request, { + useProtoFieldName: true, + emitDefaultValues: false, + }); + const promise = this.rpc.request("github.actions.results.api.v1.ArtifactService", "DeleteArtifact", "application/json", data); + return promise.then((data) => artifact_1.DeleteArtifactResponse.fromJson(data, { + ignoreUnknownFields: true, + })); + } } exports.ArtifactServiceClientJSON = ArtifactServiceClientJSON; class ArtifactServiceClientProtobuf { @@ -1486,6 +1613,7 @@ class ArtifactServiceClientProtobuf { this.FinalizeArtifact.bind(this); this.ListArtifacts.bind(this); this.GetSignedArtifactURL.bind(this); + this.DeleteArtifact.bind(this); } CreateArtifact(request) { const data = artifact_1.CreateArtifactRequest.toBinary(request); @@ -1507,6 +1635,11 @@ class ArtifactServiceClientProtobuf { const promise = this.rpc.request("github.actions.results.api.v1.ArtifactService", "GetSignedArtifactURL", "application/protobuf", data); return promise.then((data) => artifact_1.GetSignedArtifactURLResponse.fromBinary(data)); } + DeleteArtifact(request) { + const data = artifact_1.DeleteArtifactRequest.toBinary(request); + const promise = this.rpc.request("github.actions.results.api.v1.ArtifactService", "DeleteArtifact", "application/protobuf", data); + return promise.then((data) => artifact_1.DeleteArtifactResponse.fromBinary(data)); + } } exports.ArtifactServiceClientProtobuf = ArtifactServiceClientProtobuf; var ArtifactServiceMethod; @@ -1515,12 +1648,14 @@ var ArtifactServiceMethod; ArtifactServiceMethod["FinalizeArtifact"] = "FinalizeArtifact"; ArtifactServiceMethod["ListArtifacts"] = "ListArtifacts"; ArtifactServiceMethod["GetSignedArtifactURL"] = "GetSignedArtifactURL"; + ArtifactServiceMethod["DeleteArtifact"] = "DeleteArtifact"; })(ArtifactServiceMethod || (exports.ArtifactServiceMethod = ArtifactServiceMethod = {})); exports.ArtifactServiceMethodList = [ ArtifactServiceMethod.CreateArtifact, ArtifactServiceMethod.FinalizeArtifact, ArtifactServiceMethod.ListArtifacts, ArtifactServiceMethod.GetSignedArtifactURL, + ArtifactServiceMethod.DeleteArtifact, ]; function createArtifactServiceServer(service) { return new twirp_ts_1.TwirpServer({ @@ -1558,6 +1693,12 @@ function matchArtifactServiceRoute(method, events) { yield events.onMatch(ctx); return handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors); }); + case "DeleteArtifact": + return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { + ctx = Object.assign(Object.assign({}, ctx), { methodName: "DeleteArtifact" }); + yield events.onMatch(ctx); + return handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors); + }); default: events.onNotFound(); const msg = `no handler found`; @@ -1608,6 +1749,17 @@ function handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, in throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); } } +function handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors) { + switch (ctx.contentType) { + case twirp_ts_1.TwirpContentType.JSON: + return handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors); + case twirp_ts_1.TwirpContentType.Protobuf: + return handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors); + default: + const msg = "unexpected Content-Type"; + throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); + } +} function handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors) { return __awaiter(this, void 0, void 0, function* () { let request; @@ -1732,6 +1884,37 @@ function handleArtifactServiceGetSignedArtifactURLJSON(ctx, service, data, inter })); }); } +function handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors) { + return __awaiter(this, void 0, void 0, function* () { + let request; + let response; + try { + const body = JSON.parse(data.toString() || "{}"); + request = artifact_1.DeleteArtifactRequest.fromJson(body, { + ignoreUnknownFields: true, + }); + } + catch (e) { + if (e instanceof Error) { + const msg = "the json request could not be decoded"; + throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); + } + } + if (interceptors && interceptors.length > 0) { + const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); + response = yield interceptor(ctx, request, (ctx, inputReq) => { + return service.DeleteArtifact(ctx, inputReq); + }); + } + else { + response = yield service.DeleteArtifact(ctx, request); + } + return JSON.stringify(artifact_1.DeleteArtifactResponse.toJson(response, { + useProtoFieldName: true, + emitDefaultValues: false, + })); + }); +} function handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors) { return __awaiter(this, void 0, void 0, function* () { let request; @@ -1832,6 +2015,31 @@ function handleArtifactServiceGetSignedArtifactURLProtobuf(ctx, service, data, i return Buffer.from(artifact_1.GetSignedArtifactURLResponse.toBinary(response)); }); } +function handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors) { + return __awaiter(this, void 0, void 0, function* () { + let request; + let response; + try { + request = artifact_1.DeleteArtifactRequest.fromBinary(data); + } + catch (e) { + if (e instanceof Error) { + const msg = "the protobuf request could not be decoded"; + throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); + } + } + if (interceptors && interceptors.length > 0) { + const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); + response = yield interceptor(ctx, request, (ctx, inputReq) => { + return service.DeleteArtifact(ctx, inputReq); + }); + } + else { + response = yield service.DeleteArtifact(ctx, request); + } + return Buffer.from(artifact_1.DeleteArtifactResponse.toBinary(response)); + }); +} //# sourceMappingURL=artifact.twirp.js.map /***/ }), @@ -1867,6 +2075,7 @@ const core_1 = __nccwpck_require__(42186); const config_1 = __nccwpck_require__(74610); const upload_artifact_1 = __nccwpck_require__(42578); const download_artifact_1 = __nccwpck_require__(73555); +const delete_artifact_1 = __nccwpck_require__(70071); const get_artifact_1 = __nccwpck_require__(29491); const list_artifacts_1 = __nccwpck_require__(44141); const errors_1 = __nccwpck_require__(38182); @@ -1953,6 +2162,28 @@ If the error persists, please check whether Actions and API requests are operati Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. +If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); + throw error; + } + }); + } + deleteArtifact(artifactName, options) { + return __awaiter(this, void 0, void 0, function* () { + try { + if ((0, config_1.isGhes)()) { + throw new errors_1.GHESNotSupportedError(); + } + if (options === null || options === void 0 ? void 0 : options.findBy) { + const { findBy: { repositoryOwner, repositoryName, workflowRunId, token } } = options; + return (0, delete_artifact_1.deleteArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token); + } + return (0, delete_artifact_1.deleteArtifactInternal)(artifactName); + } + catch (error) { + (0, core_1.warning)(`Delete Artifact failed with error: ${error}. + +Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. + If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`); throw error; } @@ -1964,6 +2195,96 @@ exports.DefaultArtifactClient = DefaultArtifactClient; /***/ }), +/***/ 70071: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.deleteArtifactInternal = exports.deleteArtifactPublic = void 0; +const core_1 = __nccwpck_require__(42186); +const github_1 = __nccwpck_require__(95438); +const user_agent_1 = __nccwpck_require__(85164); +const retry_options_1 = __nccwpck_require__(64597); +const utils_1 = __nccwpck_require__(73030); +const plugin_request_log_1 = __nccwpck_require__(68883); +const plugin_retry_1 = __nccwpck_require__(86298); +const artifact_twirp_client_1 = __nccwpck_require__(12312); +const util_1 = __nccwpck_require__(63062); +const generated_1 = __nccwpck_require__(49960); +const get_artifact_1 = __nccwpck_require__(29491); +const errors_1 = __nccwpck_require__(38182); +function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); + const opts = { + log: undefined, + userAgent: (0, user_agent_1.getUserAgentString)(), + previews: undefined, + retry: retryOpts, + request: requestOpts + }; + const github = (0, github_1.getOctokit)(token, opts, plugin_retry_1.retry, plugin_request_log_1.requestLog); + const getArtifactResp = yield (0, get_artifact_1.getArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token); + const deleteArtifactResp = yield github.rest.actions.deleteArtifact({ + owner: repositoryOwner, + repo: repositoryName, + artifact_id: getArtifactResp.artifact.id + }); + if (deleteArtifactResp.status !== 204) { + throw new errors_1.InvalidResponseError(`Invalid response from GitHub API: ${deleteArtifactResp.status} (${(_a = deleteArtifactResp === null || deleteArtifactResp === void 0 ? void 0 : deleteArtifactResp.headers) === null || _a === void 0 ? void 0 : _a['x-github-request-id']})`); + } + return { + id: getArtifactResp.artifact.id + }; + }); +} +exports.deleteArtifactPublic = deleteArtifactPublic; +function deleteArtifactInternal(artifactName) { + return __awaiter(this, void 0, void 0, function* () { + const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); + const { workflowRunBackendId, workflowJobRunBackendId } = (0, util_1.getBackendIdsFromToken)(); + const listReq = { + workflowRunBackendId, + workflowJobRunBackendId, + nameFilter: generated_1.StringValue.create({ value: artifactName }) + }; + const listRes = yield artifactClient.ListArtifacts(listReq); + if (listRes.artifacts.length === 0) { + throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`); + } + let artifact = listRes.artifacts[0]; + if (listRes.artifacts.length > 1) { + artifact = listRes.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0]; + (0, core_1.debug)(`More than one artifact found for a single name, returning newest (id: ${artifact.databaseId})`); + } + const req = { + workflowRunBackendId: artifact.workflowRunBackendId, + workflowJobRunBackendId: artifact.workflowJobRunBackendId, + name: artifact.name + }; + const res = yield artifactClient.DeleteArtifact(req); + (0, core_1.info)(`Artifact '${artifactName}' (ID: ${res.artifactId}) deleted`); + return { + id: Number(res.artifactId) + }; + }); +} +exports.deleteArtifactInternal = deleteArtifactInternal; +//# sourceMappingURL=delete-artifact.js.map + +/***/ }), + /***/ 73555: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2248,7 +2569,9 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit throw new errors_1.InvalidResponseError(`Invalid response from GitHub API: ${getArtifactResp.status} (${(_a = getArtifactResp === null || getArtifactResp === void 0 ? void 0 : getArtifactResp.headers) === null || _a === void 0 ? void 0 : _a['x-github-request-id']})`); } if (getArtifactResp.data.artifacts.length === 0) { - throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`); + throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName} + Please ensure that your artifact is not expired and the artifact was uploaded using a compatible version of toolkit/upload-artifact. + For more information, visit the GitHub Artifacts FAQ: https://github.com/actions/toolkit/blob/main/packages/artifact/docs/faq.md`); } let artifact = getArtifactResp.data.artifacts[0]; if (getArtifactResp.data.artifacts.length > 1) { @@ -2277,7 +2600,9 @@ function getArtifactInternal(artifactName) { }; const res = yield artifactClient.ListArtifacts(req); if (res.artifacts.length === 0) { - throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`); + throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName} + Please ensure that your artifact is not expired and the artifact was uploaded using a compatible version of toolkit/upload-artifact. + For more information, visit the GitHub Artifacts FAQ: https://github.com/actions/toolkit/blob/main/packages/artifact/docs/faq.md`); } let artifact = res.artifacts[0]; if (res.artifacts.length > 1) { @@ -2699,7 +3024,10 @@ function getResultsServiceUrl() { exports.getResultsServiceUrl = getResultsServiceUrl; function isGhes() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); - return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; + const hostname = ghUrl.hostname.trimEnd().toUpperCase(); + const isGitHubHost = hostname === 'GITHUB.COM'; + const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST'); + return !isGitHubHost && !isGheHost; } exports.isGhes = isGhes; function getGitHubWorkspaceDir() { @@ -124893,7 +125221,7 @@ exports.unescape = unescape; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.0.1","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":"^5.3.1","crypto":"^1.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.1.1","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":"^5.3.1","crypto":"^1.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"}}'); /***/ }), From 348754975ef0295bfa2c111cba996120cfdf8a5d Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Mon, 5 Feb 2024 17:20:20 -0500 Subject: [PATCH 06/12] Update release-new-action-version.yml (#292) --- .github/workflows/release-new-action-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-new-action-version.yml b/.github/workflows/release-new-action-version.yml index b8076d4..efd22b3 100644 --- a/.github/workflows/release-new-action-version.yml +++ b/.github/workflows/release-new-action-version.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Update the ${{ env.TAG_NAME }} tag - uses: actions/publish-action@v0.2.1 + uses: actions/publish-action@v0.3.0 with: source-tag: ${{ env.TAG_NAME }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }} From 67d37cd34678091933f0a88cd1bb026171ea20d2 Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:42:29 -0500 Subject: [PATCH 07/12] Update toolkit --- dist/index.js | 55 +++++++++++++++++++++++++++++++++++++++++++---- package-lock.json | 12 +++++------ 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index bd49f47..e1ab3b2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2328,6 +2328,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0; const promises_1 = __importDefault(__nccwpck_require__(73292)); +const stream = __importStar(__nccwpck_require__(12781)); +const fs_1 = __nccwpck_require__(57147); +const path = __importStar(__nccwpck_require__(71017)); const github = __importStar(__nccwpck_require__(95438)); const core = __importStar(__nccwpck_require__(42186)); const httpClient = __importStar(__nccwpck_require__(96255)); @@ -2368,6 +2371,9 @@ function streamExtract(url, directory) { return; } catch (error) { + if (error.message.includes('Malformed extraction path')) { + throw new Error(`Artifact download failed with unretryable error: ${error.message}`); + } retryCount++; core.debug(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); // wait 5 seconds before retrying @@ -2390,6 +2396,8 @@ function streamExtractExternal(url, directory) { response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`)); }; const timer = setTimeout(timerFn, timeout); + const createdDirectories = new Set(); + createdDirectories.add(directory); response.message .on('data', () => { timer.refresh(); @@ -2399,11 +2407,50 @@ function streamExtractExternal(url, directory) { clearTimeout(timer); reject(error); }) - .pipe(unzip_stream_1.default.Extract({ path: directory })) - .on('close', () => { + .pipe(unzip_stream_1.default.Parse()) + .pipe(new stream.Transform({ + objectMode: true, + transform: (entry, _, callback) => __awaiter(this, void 0, void 0, function* () { + const fullPath = path.normalize(path.join(directory, entry.path)); + if (!directory.endsWith(path.sep)) { + directory += path.sep; + } + if (!fullPath.startsWith(directory)) { + reject(new Error(`Malformed extraction path: ${fullPath}`)); + } + core.debug(`Extracting artifact entry: ${fullPath}`); + if (entry.type === 'Directory') { + if (!createdDirectories.has(fullPath)) { + createdDirectories.add(fullPath); + yield resolveOrCreateDirectory(fullPath).then(() => { + entry.autodrain(); + callback(); + }); + } + else { + entry.autodrain(); + callback(); + } + } + else { + if (!createdDirectories.has(path.dirname(fullPath))) { + createdDirectories.add(path.dirname(fullPath)); + yield resolveOrCreateDirectory(path.dirname(fullPath)).then(() => { + entry.autodrain(); + callback(); + }); + } + const writeStream = (0, fs_1.createWriteStream)(fullPath); + writeStream.on('finish', callback); + writeStream.on('error', reject); + entry.pipe(writeStream); + } + }) + })) + .on('finish', () => __awaiter(this, void 0, void 0, function* () { clearTimeout(timer); resolve(); - }) + })) .on('error', (error) => { reject(error); }); @@ -125221,7 +125268,7 @@ exports.unescape = unescape; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.1","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":"^5.3.1","crypto":"^1.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.1.2","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":"^5.3.1","crypto":"^1.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/package-lock.json b/package-lock.json index 6df9b30..929c39f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,9 +36,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", - "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", + "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -5862,9 +5862,9 @@ "dev": true }, "@actions/artifact": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", - "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", + "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", From 7c63dfde29f42bb9cb0f61b67e54c91106a6586e Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:49:11 -0500 Subject: [PATCH 08/12] licensed --- .licenses/npm/@actions/artifact.dep.yml | 6 +++--- .licenses/npm/minimatch.dep.yml | 26 ------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 .licenses/npm/minimatch.dep.yml diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index bc59d55..ad1c399 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.1 +version: 2.1.2 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/.licenses/npm/minimatch.dep.yml b/.licenses/npm/minimatch.dep.yml deleted file mode 100644 index 5709755..0000000 --- a/.licenses/npm/minimatch.dep.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: minimatch -version: 9.0.3 -type: npm -summary: -homepage: -license: isc -licenses: -- sources: LICENSE - text: | - The ISC License - - Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -notices: [] From f71c0e3da3bb6b4fcc53196b9ac75ee981db5bc6 Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:51:09 -0500 Subject: [PATCH 09/12] Revert "licensed" This reverts commit 7c63dfde29f42bb9cb0f61b67e54c91106a6586e. --- .licenses/npm/@actions/artifact.dep.yml | 6 +++--- .licenses/npm/minimatch.dep.yml | 26 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .licenses/npm/minimatch.dep.yml diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index ad1c399..bc59d55 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.2 +version: 2.1.1 type: npm -summary: Actions artifact lib -homepage: https://github.com/actions/toolkit/tree/main/packages/artifact +summary: +homepage: license: mit licenses: - sources: LICENSE.md diff --git a/.licenses/npm/minimatch.dep.yml b/.licenses/npm/minimatch.dep.yml new file mode 100644 index 0000000..5709755 --- /dev/null +++ b/.licenses/npm/minimatch.dep.yml @@ -0,0 +1,26 @@ +--- +name: minimatch +version: 9.0.3 +type: npm +summary: +homepage: +license: isc +licenses: +- sources: LICENSE + text: | + The ISC License + + Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +notices: [] From 6dd49bff0a6150b47d41011c034b762053acaf6f Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:51:43 -0500 Subject: [PATCH 10/12] licensed only artifact --- .licenses/npm/@actions/artifact.dep.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index bc59d55..ad1c399 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.1 +version: 2.1.2 type: npm -summary: -homepage: +summary: Actions artifact lib +homepage: https://github.com/actions/toolkit/tree/main/packages/artifact license: mit licenses: - sources: LICENSE.md From 47f9ce604fdcae5583e5ef84048eeb7ef2893652 Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Mon, 26 Feb 2024 10:40:04 -0500 Subject: [PATCH 11/12] update @actions/artifact --- .licenses/npm/@actions/artifact.dep.yml | 2 +- dist/index.js | 7 ++----- package-lock.json | 12 ++++++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index ad1c399..7678acf 100644 --- a/.licenses/npm/@actions/artifact.dep.yml +++ b/.licenses/npm/@actions/artifact.dep.yml @@ -1,6 +1,6 @@ --- name: "@actions/artifact" -version: 2.1.2 +version: 2.1.3 type: npm summary: Actions artifact lib homepage: https://github.com/actions/toolkit/tree/main/packages/artifact diff --git a/dist/index.js b/dist/index.js index e1ab3b2..47119bb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2435,10 +2435,7 @@ function streamExtractExternal(url, directory) { else { if (!createdDirectories.has(path.dirname(fullPath))) { createdDirectories.add(path.dirname(fullPath)); - yield resolveOrCreateDirectory(path.dirname(fullPath)).then(() => { - entry.autodrain(); - callback(); - }); + yield resolveOrCreateDirectory(path.dirname(fullPath)); } const writeStream = (0, fs_1.createWriteStream)(fullPath); writeStream.on('finish', callback); @@ -125268,7 +125265,7 @@ exports.unescape = unescape; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.2","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":"^5.3.1","crypto":"^1.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.1.3","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":"^5.3.1","crypto":"^1.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/package-lock.json b/package-lock.json index 929c39f..f65db79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,9 +36,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", - "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.3.tgz", + "integrity": "sha512-ovuxwbMn0aX8zeQ2ORiZZ0KQYhWwW4NuTCBie530rvxUqaq/83XpqWl1/tHONJuVkck46lfShxjfxhLywTKwyg==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -5862,9 +5862,9 @@ "dev": true }, "@actions/artifact": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", - "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.3.tgz", + "integrity": "sha512-ovuxwbMn0aX8zeQ2ORiZZ0KQYhWwW4NuTCBie530rvxUqaq/83XpqWl1/tHONJuVkck46lfShxjfxhLywTKwyg==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", From 6fd111f15ace90c9fbd0d73880db8338a776aaed Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 1 Mar 2024 13:20:31 -0500 Subject: [PATCH 12/12] update @actions/artifact --- .licenses/npm/@actions/artifact.dep.yml | 2 +- dist/index.js | 4 ++-- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index 7678acf..76b069d 100644 --- a/.licenses/npm/@actions/artifact.dep.yml +++ b/.licenses/npm/@actions/artifact.dep.yml @@ -1,6 +1,6 @@ --- name: "@actions/artifact" -version: 2.1.3 +version: 2.1.4 type: npm summary: Actions artifact lib homepage: https://github.com/actions/toolkit/tree/main/packages/artifact diff --git a/dist/index.js b/dist/index.js index 47119bb..e6f8475 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2418,7 +2418,6 @@ function streamExtractExternal(url, directory) { if (!fullPath.startsWith(directory)) { reject(new Error(`Malformed extraction path: ${fullPath}`)); } - core.debug(`Extracting artifact entry: ${fullPath}`); if (entry.type === 'Directory') { if (!createdDirectories.has(fullPath)) { createdDirectories.add(fullPath); @@ -2433,6 +2432,7 @@ function streamExtractExternal(url, directory) { } } else { + core.info(`Extracting artifact entry: ${fullPath}`); if (!createdDirectories.has(path.dirname(fullPath))) { createdDirectories.add(path.dirname(fullPath)); yield resolveOrCreateDirectory(path.dirname(fullPath)); @@ -125265,7 +125265,7 @@ exports.unescape = unescape; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.3","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":"^5.3.1","crypto":"^1.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.1.4","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":"^5.3.1","crypto":"^1.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/package-lock.json b/package-lock.json index f65db79..7564a8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "download-artifact", - "version": "4.0.1", + "version": "4.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "download-artifact", - "version": "4.0.1", + "version": "4.1.4", "license": "MIT", "dependencies": { "@actions/artifact": "^2.1.1", @@ -36,9 +36,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.3.tgz", - "integrity": "sha512-ovuxwbMn0aX8zeQ2ORiZZ0KQYhWwW4NuTCBie530rvxUqaq/83XpqWl1/tHONJuVkck46lfShxjfxhLywTKwyg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.4.tgz", + "integrity": "sha512-nKgNduFA02drKt4rFqXsF6PjWmfKdxZDuWWdenoI1bBzgys3y8O7kw4gAS+gvLOT3EfsyV+mwTIisuXBjwQ3RA==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -5862,9 +5862,9 @@ "dev": true }, "@actions/artifact": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.3.tgz", - "integrity": "sha512-ovuxwbMn0aX8zeQ2ORiZZ0KQYhWwW4NuTCBie530rvxUqaq/83XpqWl1/tHONJuVkck46lfShxjfxhLywTKwyg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.4.tgz", + "integrity": "sha512-nKgNduFA02drKt4rFqXsF6PjWmfKdxZDuWWdenoI1bBzgys3y8O7kw4gAS+gvLOT3EfsyV+mwTIisuXBjwQ3RA==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", diff --git a/package.json b/package.json index 7bc5f80..cea15bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "download-artifact", - "version": "4.0.1", + "version": "4.1.4", "description": "Download an Actions Artifact from a workflow run", "main": "dist/index.js", "scripts": { @@ -44,4 +44,4 @@ "prettier": "^3.1.1", "typescript": "^5.3.3" } -} \ No newline at end of file +}