diff --git a/scan/dist/index.js b/scan/dist/index.js index 71bdd62f..2efd6ed9 100644 --- a/scan/dist/index.js +++ b/scan/dist/index.js @@ -87242,7 +87242,7 @@ var require_artifact = __commonJS({ "../node_modules/@actions/artifact/lib/generated/results/api/v1/artifact.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ArtifactService = exports2.GetSignedArtifactURLResponse = exports2.GetSignedArtifactURLRequest = exports2.ListArtifactsResponse_MonolithArtifact = exports2.ListArtifactsResponse = exports2.ListArtifactsRequest = exports2.FinalizeArtifactResponse = exports2.FinalizeArtifactRequest = exports2.CreateArtifactResponse = exports2.CreateArtifactRequest = void 0; + exports2.ArtifactService = exports2.DeleteArtifactResponse = exports2.DeleteArtifactRequest = exports2.GetSignedArtifactURLResponse = exports2.GetSignedArtifactURLRequest = exports2.ListArtifactsResponse_MonolithArtifact = exports2.ListArtifactsResponse = exports2.ListArtifactsRequest = exports2.FinalizeArtifactResponse = exports2.FinalizeArtifactRequest = exports2.CreateArtifactResponse = exports2.CreateArtifactRequest = void 0; var runtime_rpc_1 = require_commonjs2(); var runtime_1 = require_commonjs(); var runtime_2 = require_commonjs(); @@ -87944,11 +87944,155 @@ var require_artifact = __commonJS({ } }; exports2.GetSignedArtifactURLResponse = new GetSignedArtifactURLResponse$Type(); + var DeleteArtifactRequest$Type = class extends runtime_5.MessageType { + static { + __name(this, "DeleteArtifactRequest$Type"); + } + 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 !== void 0) + (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) { + if (message.workflowRunBackendId !== "") + writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.workflowRunBackendId); + if (message.workflowJobRunBackendId !== "") + writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.workflowJobRunBackendId); + 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; + } + }; + exports2.DeleteArtifactRequest = new DeleteArtifactRequest$Type(); + var DeleteArtifactResponse$Type = class extends runtime_5.MessageType { + static { + __name(this, "DeleteArtifactResponse$Type"); + } + 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 !== void 0) + (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) { + if (message.ok !== false) + writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); + 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; + } + }; + exports2.DeleteArtifactResponse = new DeleteArtifactResponse$Type(); exports2.ArtifactService = new runtime_rpc_1.ServiceType("github.actions.results.api.v1.ArtifactService", [ { name: "CreateArtifact", options: {}, I: exports2.CreateArtifactRequest, O: exports2.CreateArtifactResponse }, { name: "FinalizeArtifact", options: {}, I: exports2.FinalizeArtifactRequest, O: exports2.FinalizeArtifactResponse }, { name: "ListArtifacts", options: {}, I: exports2.ListArtifactsRequest, O: exports2.ListArtifactsResponse }, - { name: "GetSignedArtifactURL", options: {}, I: exports2.GetSignedArtifactURLRequest, O: exports2.GetSignedArtifactURLResponse } + { name: "GetSignedArtifactURL", options: {}, I: exports2.GetSignedArtifactURLRequest, O: exports2.GetSignedArtifactURLResponse }, + { name: "DeleteArtifact", options: {}, I: exports2.DeleteArtifactRequest, O: exports2.DeleteArtifactResponse } ]); } }); @@ -89526,6 +89670,7 @@ var require_artifact_twirp = __commonJS({ 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, { @@ -89565,6 +89710,16 @@ var require_artifact_twirp = __commonJS({ 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((data2) => artifact_1.DeleteArtifactResponse.fromJson(data2, { + ignoreUnknownFields: true + })); + } }; exports2.ArtifactServiceClientJSON = ArtifactServiceClientJSON; var ArtifactServiceClientProtobuf = class { @@ -89577,6 +89732,7 @@ var require_artifact_twirp = __commonJS({ 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); @@ -89598,6 +89754,11 @@ var require_artifact_twirp = __commonJS({ const promise = this.rpc.request("github.actions.results.api.v1.ArtifactService", "GetSignedArtifactURL", "application/protobuf", data); return promise.then((data2) => artifact_1.GetSignedArtifactURLResponse.fromBinary(data2)); } + 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((data2) => artifact_1.DeleteArtifactResponse.fromBinary(data2)); + } }; exports2.ArtifactServiceClientProtobuf = ArtifactServiceClientProtobuf; var ArtifactServiceMethod; @@ -89606,12 +89767,14 @@ var require_artifact_twirp = __commonJS({ ArtifactServiceMethod2["FinalizeArtifact"] = "FinalizeArtifact"; ArtifactServiceMethod2["ListArtifacts"] = "ListArtifacts"; ArtifactServiceMethod2["GetSignedArtifactURL"] = "GetSignedArtifactURL"; + ArtifactServiceMethod2["DeleteArtifact"] = "DeleteArtifact"; })(ArtifactServiceMethod || (exports2.ArtifactServiceMethod = ArtifactServiceMethod = {})); exports2.ArtifactServiceMethodList = [ ArtifactServiceMethod.CreateArtifact, ArtifactServiceMethod.FinalizeArtifact, ArtifactServiceMethod.ListArtifacts, - ArtifactServiceMethod.GetSignedArtifactURL + ArtifactServiceMethod.GetSignedArtifactURL, + ArtifactServiceMethod.DeleteArtifact ]; function createArtifactServiceServer(service) { return new twirp_ts_1.TwirpServer({ @@ -89650,6 +89813,12 @@ var require_artifact_twirp = __commonJS({ yield events.onMatch(ctx); return handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors); }); + case "DeleteArtifact": + return (ctx, service, data, interceptors) => __awaiter3(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`; @@ -89705,6 +89874,18 @@ var require_artifact_twirp = __commonJS({ } } __name(handleArtifactServiceGetSignedArtifactURLRequest, "handleArtifactServiceGetSignedArtifactURLRequest"); + 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); + } + } + __name(handleArtifactServiceDeleteArtifactRequest, "handleArtifactServiceDeleteArtifactRequest"); function handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors) { return __awaiter3(this, void 0, void 0, function* () { let request; @@ -89825,6 +90006,36 @@ var require_artifact_twirp = __commonJS({ }); } __name(handleArtifactServiceGetSignedArtifactURLJSON, "handleArtifactServiceGetSignedArtifactURLJSON"); + function handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors) { + return __awaiter3(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, (ctx2, inputReq) => { + return service.DeleteArtifact(ctx2, inputReq); + }); + } else { + response = yield service.DeleteArtifact(ctx, request); + } + return JSON.stringify(artifact_1.DeleteArtifactResponse.toJson(response, { + useProtoFieldName: true, + emitDefaultValues: false + })); + }); + } + __name(handleArtifactServiceDeleteArtifactJSON, "handleArtifactServiceDeleteArtifactJSON"); function handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors) { return __awaiter3(this, void 0, void 0, function* () { let request; @@ -89921,6 +90132,30 @@ var require_artifact_twirp = __commonJS({ }); } __name(handleArtifactServiceGetSignedArtifactURLProtobuf, "handleArtifactServiceGetSignedArtifactURLProtobuf"); + function handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors) { + return __awaiter3(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, (ctx2, inputReq) => { + return service.DeleteArtifact(ctx2, inputReq); + }); + } else { + response = yield service.DeleteArtifact(ctx, request); + } + return Buffer.from(artifact_1.DeleteArtifactResponse.toBinary(response)); + }); + } + __name(handleArtifactServiceDeleteArtifactProtobuf, "handleArtifactServiceDeleteArtifactProtobuf"); } }); @@ -90091,7 +90326,7 @@ var require_package = __commonJS({ "../node_modules/@actions/artifact/package.json"(exports2, module2) { module2.exports = { name: "@actions/artifact", - version: "2.0.1", + version: "2.1.0", preview: true, description: "Actions artifact lib", keywords: [ @@ -124573,6 +124808,94 @@ Are you trying to download from a different run? Try specifying a github-token w } }); +// ../node_modules/@actions/artifact/lib/internal/find/retry-options.js +var require_retry_options = __commonJS({ + "../node_modules/@actions/artifact/lib/internal/find/retry-options.js"(exports2) { + "use strict"; + var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault3 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar3 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding3(result, mod, k); + } + __setModuleDefault3(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRetryOptions = void 0; + var core2 = __importStar3(require_core()); + var defaultMaxRetryNumber = 5; + var defaultExemptStatusCodes = [400, 401, 403, 404, 422]; + function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exemptStatusCodes = defaultExemptStatusCodes) { + var _a; + if (retries <= 0) { + return [{ enabled: false }, defaultOptions.request]; + } + const retryOptions = { + enabled: true + }; + if (exemptStatusCodes.length > 0) { + retryOptions.doNotRetry = exemptStatusCodes; + } + const requestOptions = Object.assign(Object.assign({}, defaultOptions.request), { retries }); + core2.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a = retryOptions.doNotRetry) !== null && _a !== void 0 ? _a : "octokit default: [400, 401, 403, 404, 422]"})`); + return [retryOptions, requestOptions]; + } + __name(getRetryOptions, "getRetryOptions"); + exports2.getRetryOptions = getRetryOptions; + } +}); + +// ../node_modules/@actions/artifact/node_modules/@octokit/plugin-request-log/dist-node/index.js +var require_dist_node19 = __commonJS({ + "../node_modules/@actions/artifact/node_modules/@octokit/plugin-request-log/dist-node/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var VERSION2 = "1.0.4"; + function requestLog(octokit) { + octokit.hook.wrap("request", (request, options) => { + octokit.log.debug("request", options); + const start = Date.now(); + const requestOptions = octokit.request.endpoint.parse(options); + const path = requestOptions.url.replace(options.baseUrl, ""); + return request(options).then((response) => { + octokit.log.info(`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`); + return response; + }).catch((error) => { + octokit.log.info(`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`); + throw error; + }); + }); + } + __name(requestLog, "requestLog"); + requestLog.VERSION = VERSION2; + exports2.requestLog = requestLog; + } +}); + // ../node_modules/bottleneck/light.js var require_light = __commonJS({ "../node_modules/bottleneck/light.js"(exports2, module2) { @@ -125927,7 +126250,7 @@ var require_light = __commonJS({ }); // ../node_modules/@octokit/plugin-retry/dist-node/index.js -var require_dist_node19 = __commonJS({ +var require_dist_node20 = __commonJS({ "../node_modules/@octokit/plugin-retry/dist-node/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -125992,94 +126315,6 @@ var require_dist_node19 = __commonJS({ } }); -// ../node_modules/@actions/artifact/lib/internal/find/retry-options.js -var require_retry_options = __commonJS({ - "../node_modules/@actions/artifact/lib/internal/find/retry-options.js"(exports2) { - "use strict"; - var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault3 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar3 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding3(result, mod, k); - } - __setModuleDefault3(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRetryOptions = void 0; - var core2 = __importStar3(require_core()); - var defaultMaxRetryNumber = 5; - var defaultExemptStatusCodes = [400, 401, 403, 404, 422]; - function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exemptStatusCodes = defaultExemptStatusCodes) { - var _a; - if (retries <= 0) { - return [{ enabled: false }, defaultOptions.request]; - } - const retryOptions = { - enabled: true - }; - if (exemptStatusCodes.length > 0) { - retryOptions.doNotRetry = exemptStatusCodes; - } - const requestOptions = Object.assign(Object.assign({}, defaultOptions.request), { retries }); - core2.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a = retryOptions.doNotRetry) !== null && _a !== void 0 ? _a : "octokit default: [400, 401, 403, 404, 422]"})`); - return [retryOptions, requestOptions]; - } - __name(getRetryOptions, "getRetryOptions"); - exports2.getRetryOptions = getRetryOptions; - } -}); - -// ../node_modules/@actions/artifact/node_modules/@octokit/plugin-request-log/dist-node/index.js -var require_dist_node20 = __commonJS({ - "../node_modules/@actions/artifact/node_modules/@octokit/plugin-request-log/dist-node/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var VERSION2 = "1.0.4"; - function requestLog(octokit) { - octokit.hook.wrap("request", (request, options) => { - octokit.log.debug("request", options); - const start = Date.now(); - const requestOptions = octokit.request.endpoint.parse(options); - const path = requestOptions.url.replace(options.baseUrl, ""); - return request(options).then((response) => { - octokit.log.info(`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`); - return response; - }).catch((error) => { - octokit.log.info(`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`); - throw error; - }); - }); - } - __name(requestLog, "requestLog"); - requestLog.VERSION = VERSION2; - exports2.requestLog = requestLog; - } -}); - // ../node_modules/@actions/artifact/lib/internal/find/get-artifact.js var require_get_artifact = __commonJS({ "../node_modules/@actions/artifact/lib/internal/find/get-artifact.js"(exports2) { @@ -126150,11 +126385,11 @@ var require_get_artifact = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getArtifactInternal = exports2.getArtifactPublic = void 0; var github_1 = require_github2(); - var plugin_retry_1 = require_dist_node19(); + var plugin_retry_1 = require_dist_node20(); var core2 = __importStar3(require_core()); var utils_12 = require_utils9(); var retry_options_1 = require_retry_options(); - var plugin_request_log_1 = require_dist_node20(); + var plugin_request_log_1 = require_dist_node19(); var util_1 = require_util8(); var user_agent_1 = require_user_agent(); var artifact_twirp_client_1 = require_artifact_twirp_client(); @@ -126182,7 +126417,9 @@ var require_get_artifact = __commonJS({ 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) { @@ -126212,7 +126449,9 @@ var require_get_artifact = __commonJS({ }; 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) { @@ -126234,6 +126473,118 @@ var require_get_artifact = __commonJS({ } }); +// ../node_modules/@actions/artifact/lib/internal/delete/delete-artifact.js +var require_delete_artifact = __commonJS({ + "../node_modules/@actions/artifact/lib/internal/delete/delete-artifact.js"(exports2) { + "use strict"; + var __awaiter3 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + __name(adopt, "adopt"); + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + __name(fulfilled, "fulfilled"); + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + __name(rejected, "rejected"); + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + __name(step, "step"); + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.deleteArtifactInternal = exports2.deleteArtifactPublic = void 0; + var core_1 = require_core(); + var github_1 = require_github2(); + var user_agent_1 = require_user_agent(); + var retry_options_1 = require_retry_options(); + var utils_12 = require_utils9(); + var plugin_request_log_1 = require_dist_node19(); + var plugin_retry_1 = require_dist_node20(); + var artifact_twirp_client_1 = require_artifact_twirp_client(); + var util_1 = require_util8(); + var generated_1 = require_generated(); + var get_artifact_1 = require_get_artifact(); + var errors_1 = require_errors3(); + function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { + var _a; + return __awaiter3(this, void 0, void 0, function* () { + const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_12.defaults); + const opts = { + log: void 0, + userAgent: (0, user_agent_1.getUserAgentString)(), + previews: void 0, + retry: retryOpts, + request: requestOpts + }; + const github2 = (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 github2.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 + }; + }); + } + __name(deleteArtifactPublic, "deleteArtifactPublic"); + exports2.deleteArtifactPublic = deleteArtifactPublic; + function deleteArtifactInternal(artifactName) { + return __awaiter3(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) + }; + }); + } + __name(deleteArtifactInternal, "deleteArtifactInternal"); + exports2.deleteArtifactInternal = deleteArtifactInternal; + } +}); + // ../node_modules/@actions/artifact/lib/internal/find/list-artifacts.js var require_list_artifacts = __commonJS({ "../node_modules/@actions/artifact/lib/internal/find/list-artifacts.js"(exports2) { @@ -126276,8 +126627,8 @@ var require_list_artifacts = __commonJS({ var user_agent_1 = require_user_agent(); var retry_options_1 = require_retry_options(); var utils_12 = require_utils9(); - var plugin_request_log_1 = require_dist_node20(); - var plugin_retry_1 = require_dist_node19(); + var plugin_request_log_1 = require_dist_node19(); + var plugin_retry_1 = require_dist_node20(); var artifact_twirp_client_1 = require_artifact_twirp_client(); var util_1 = require_util8(); var generated_1 = require_generated(); @@ -126444,6 +126795,7 @@ var require_client2 = __commonJS({ var config_1 = require_config(); var upload_artifact_1 = require_upload_artifact(); var download_artifact_1 = require_download_artifact(); + var delete_artifact_1 = require_delete_artifact(); var get_artifact_1 = require_get_artifact(); var list_artifacts_1 = require_list_artifacts(); var errors_1 = require_errors3(); @@ -126526,6 +126878,27 @@ 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 __awaiter3(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; }