@actions/artifact 1.1.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -173
- package/lib/artifact.d.ts +6 -0
- package/lib/artifact.js +23 -0
- package/lib/artifact.js.map +1 -0
- package/lib/generated/google/protobuf/timestamp.d.ts +145 -0
- package/lib/generated/google/protobuf/timestamp.js +136 -0
- package/lib/generated/google/protobuf/timestamp.js.map +1 -0
- package/lib/generated/google/protobuf/wrappers.d.ts +307 -0
- package/lib/generated/google/protobuf/wrappers.js +609 -0
- package/lib/generated/google/protobuf/wrappers.js.map +1 -0
- package/lib/generated/index.d.ts +4 -0
- package/lib/generated/index.js +21 -0
- package/lib/generated/index.js.map +1 -0
- package/lib/generated/results/api/v1/artifact.d.ts +286 -0
- package/lib/generated/results/api/v1/artifact.js +588 -0
- package/lib/generated/results/api/v1/artifact.js.map +1 -0
- package/lib/generated/results/api/v1/artifact.twirp.d.ts +43 -0
- package/lib/generated/results/api/v1/artifact.twirp.js +416 -0
- package/lib/generated/results/api/v1/artifact.twirp.js.map +1 -0
- package/lib/internal/client.d.ts +61 -0
- package/lib/internal/client.js +121 -0
- package/lib/internal/client.js.map +1 -0
- package/lib/internal/download/download-artifact.d.ts +4 -0
- package/lib/internal/download/download-artifact.js +205 -0
- package/lib/internal/download/download-artifact.js.map +1 -0
- package/lib/internal/find/get-artifact.d.ts +3 -0
- package/lib/internal/find/get-artifact.js +118 -0
- package/lib/internal/find/get-artifact.js.map +1 -0
- package/lib/internal/find/list-artifacts.d.ts +3 -0
- package/lib/internal/find/list-artifacts.js +139 -0
- package/lib/internal/find/list-artifacts.js.map +1 -0
- package/lib/internal/find/retry-options.d.ts +7 -0
- package/lib/internal/find/retry-options.js +50 -0
- package/lib/internal/find/retry-options.js.map +1 -0
- package/lib/internal/shared/artifact-twirp-client.d.ts +6 -0
- package/lib/internal/shared/artifact-twirp-client.js +153 -0
- package/lib/internal/shared/artifact-twirp-client.js.map +1 -0
- package/lib/internal/shared/config.d.ts +6 -0
- package/lib/internal/shared/config.js +55 -0
- package/lib/internal/shared/config.js.map +1 -0
- package/lib/internal/shared/errors.d.ts +22 -0
- package/lib/internal/shared/errors.js +70 -0
- package/lib/internal/shared/errors.js.map +1 -0
- package/lib/internal/shared/interfaces.d.ts +136 -0
- package/lib/internal/{contracts.js → shared/interfaces.js} +1 -1
- package/lib/internal/shared/interfaces.js.map +1 -0
- package/lib/internal/shared/user-agent.d.ts +4 -0
- package/lib/internal/shared/user-agent.js +13 -0
- package/lib/internal/shared/user-agent.js.map +1 -0
- package/lib/internal/shared/util.d.ts +5 -0
- package/lib/internal/shared/util.js +81 -0
- package/lib/internal/shared/util.js.map +1 -0
- package/lib/internal/upload/blob-upload.d.ts +12 -0
- package/lib/internal/upload/blob-upload.js +87 -0
- package/lib/internal/upload/blob-upload.js.map +1 -0
- package/lib/internal/upload/path-and-artifact-name-validation.d.ts +8 -0
- package/lib/internal/{path-and-artifact-name-validation.js → upload/path-and-artifact-name-validation.js} +11 -11
- package/lib/internal/upload/path-and-artifact-name-validation.js.map +1 -0
- package/lib/internal/upload/retention.d.ts +2 -0
- package/lib/internal/upload/retention.js +54 -0
- package/lib/internal/upload/retention.js.map +1 -0
- package/lib/internal/upload/upload-artifact.d.ts +2 -0
- package/lib/internal/upload/upload-artifact.js +103 -0
- package/lib/internal/upload/upload-artifact.js.map +1 -0
- package/lib/internal/upload/upload-zip-specification.d.ts +21 -0
- package/lib/internal/{upload-specification.js → upload/upload-zip-specification.js} +44 -36
- package/lib/internal/upload/upload-zip-specification.js.map +1 -0
- package/lib/internal/upload/zip.d.ts +9 -0
- package/lib/internal/upload/zip.js +113 -0
- package/lib/internal/upload/zip.js.map +1 -0
- package/package.json +26 -12
- package/lib/artifact-client.d.ts +0 -10
- package/lib/artifact-client.js +0 -12
- package/lib/artifact-client.js.map +0 -1
- package/lib/internal/artifact-client.d.ts +0 -41
- package/lib/internal/artifact-client.js +0 -182
- package/lib/internal/artifact-client.js.map +0 -1
- package/lib/internal/config-variables.d.ts +0 -12
- package/lib/internal/config-variables.js +0 -77
- package/lib/internal/config-variables.js.map +0 -1
- package/lib/internal/contracts.d.ts +0 -67
- package/lib/internal/contracts.js.map +0 -1
- package/lib/internal/crc64.d.ts +0 -21
- package/lib/internal/crc64.js +0 -303
- package/lib/internal/crc64.js.map +0 -1
- package/lib/internal/download-http-client.d.ts +0 -39
- package/lib/internal/download-http-client.js +0 -296
- package/lib/internal/download-http-client.js.map +0 -1
- package/lib/internal/download-options.d.ts +0 -7
- package/lib/internal/download-options.js +0 -3
- package/lib/internal/download-options.js.map +0 -1
- package/lib/internal/download-response.d.ts +0 -10
- package/lib/internal/download-response.js +0 -3
- package/lib/internal/download-response.js.map +0 -1
- package/lib/internal/download-specification.d.ts +0 -19
- package/lib/internal/download-specification.js +0 -78
- package/lib/internal/download-specification.js.map +0 -1
- package/lib/internal/http-manager.d.ts +0 -12
- package/lib/internal/http-manager.js +0 -32
- package/lib/internal/http-manager.js.map +0 -1
- package/lib/internal/path-and-artifact-name-validation.d.ts +0 -8
- package/lib/internal/path-and-artifact-name-validation.js.map +0 -1
- package/lib/internal/requestUtils.d.ts +0 -3
- package/lib/internal/requestUtils.js +0 -92
- package/lib/internal/requestUtils.js.map +0 -1
- package/lib/internal/status-reporter.d.ts +0 -21
- package/lib/internal/status-reporter.js +0 -52
- package/lib/internal/status-reporter.js.map +0 -1
- package/lib/internal/upload-gzip.d.ts +0 -14
- package/lib/internal/upload-gzip.js +0 -147
- package/lib/internal/upload-gzip.js.map +0 -1
- package/lib/internal/upload-http-client.d.ts +0 -48
- package/lib/internal/upload-http-client.js +0 -415
- package/lib/internal/upload-http-client.js.map +0 -1
- package/lib/internal/upload-options.d.ts +0 -34
- package/lib/internal/upload-options.js +0 -3
- package/lib/internal/upload-options.js.map +0 -1
- package/lib/internal/upload-response.d.ts +0 -19
- package/lib/internal/upload-response.js +0 -3
- package/lib/internal/upload-response.js.map +0 -1
- package/lib/internal/upload-specification.d.ts +0 -11
- package/lib/internal/upload-specification.js.map +0 -1
- package/lib/internal/utils.d.ts +0 -71
- package/lib/internal/utils.js +0 -292
- package/lib/internal/utils.js.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getRetryOptions = void 0;
|
|
27
|
+
const core = __importStar(require("@actions/core"));
|
|
28
|
+
// Defaults for fetching artifacts
|
|
29
|
+
const defaultMaxRetryNumber = 5;
|
|
30
|
+
const defaultExemptStatusCodes = [400, 401, 403, 404, 422]; // https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14
|
|
31
|
+
function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exemptStatusCodes = defaultExemptStatusCodes) {
|
|
32
|
+
var _a;
|
|
33
|
+
if (retries <= 0) {
|
|
34
|
+
return [{ enabled: false }, defaultOptions.request];
|
|
35
|
+
}
|
|
36
|
+
const retryOptions = {
|
|
37
|
+
enabled: true
|
|
38
|
+
};
|
|
39
|
+
if (exemptStatusCodes.length > 0) {
|
|
40
|
+
retryOptions.doNotRetry = exemptStatusCodes;
|
|
41
|
+
}
|
|
42
|
+
// The GitHub type has some defaults for `options.request`
|
|
43
|
+
// see: https://github.com/actions/toolkit/blob/4fbc5c941a57249b19562015edbd72add14be93d/packages/github/src/utils.ts#L15
|
|
44
|
+
// We pass these in here so they are not overridden.
|
|
45
|
+
const requestOptions = Object.assign(Object.assign({}, defaultOptions.request), { retries });
|
|
46
|
+
core.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]'})`);
|
|
47
|
+
return [retryOptions, requestOptions];
|
|
48
|
+
}
|
|
49
|
+
exports.getRetryOptions = getRetryOptions;
|
|
50
|
+
//# sourceMappingURL=retry-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-options.js","sourceRoot":"","sources":["../../../src/internal/find/retry-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AASrC,kCAAkC;AAClC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAC/B,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,CAAC,4GAA4G;AAEvK,SAAgB,eAAe,CAC7B,cAA8B,EAC9B,UAAkB,qBAAqB,EACvC,oBAA8B,wBAAwB;;IAEtD,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,CAAC,EAAC,OAAO,EAAE,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;KAClD;IAED,MAAM,YAAY,GAAiB;QACjC,OAAO,EAAE,IAAI;KACd,CAAA;IAED,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,YAAY,CAAC,UAAU,GAAG,iBAAiB,CAAA;KAC5C;IAED,0DAA0D;IAC1D,yHAAyH;IACzH,oDAAoD;IACpD,MAAM,cAAc,mCACf,cAAc,CAAC,OAAO,KACzB,OAAO,GACR,CAAA;IAED,IAAI,CAAC,KAAK,CACR,4CACE,cAAc,CAAC,OACjB,+BACE,MAAA,YAAY,CAAC,UAAU,mCAAI,4CAC7B,GAAG,CACJ,CAAA;IAED,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;AACvC,CAAC;AAlCD,0CAkCC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.internalArtifactTwirpClient = void 0;
|
|
13
|
+
const http_client_1 = require("@actions/http-client");
|
|
14
|
+
const auth_1 = require("@actions/http-client/lib/auth");
|
|
15
|
+
const core_1 = require("@actions/core");
|
|
16
|
+
const generated_1 = require("../../generated");
|
|
17
|
+
const config_1 = require("./config");
|
|
18
|
+
const user_agent_1 = require("./user-agent");
|
|
19
|
+
const errors_1 = require("./errors");
|
|
20
|
+
class ArtifactHttpClient {
|
|
21
|
+
constructor(userAgent, maxAttempts, baseRetryIntervalMilliseconds, retryMultiplier) {
|
|
22
|
+
this.maxAttempts = 5;
|
|
23
|
+
this.baseRetryIntervalMilliseconds = 3000;
|
|
24
|
+
this.retryMultiplier = 1.5;
|
|
25
|
+
const token = (0, config_1.getRuntimeToken)();
|
|
26
|
+
this.baseUrl = (0, config_1.getResultsServiceUrl)();
|
|
27
|
+
if (maxAttempts) {
|
|
28
|
+
this.maxAttempts = maxAttempts;
|
|
29
|
+
}
|
|
30
|
+
if (baseRetryIntervalMilliseconds) {
|
|
31
|
+
this.baseRetryIntervalMilliseconds = baseRetryIntervalMilliseconds;
|
|
32
|
+
}
|
|
33
|
+
if (retryMultiplier) {
|
|
34
|
+
this.retryMultiplier = retryMultiplier;
|
|
35
|
+
}
|
|
36
|
+
this.httpClient = new http_client_1.HttpClient(userAgent, [
|
|
37
|
+
new auth_1.BearerCredentialHandler(token)
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
// This function satisfies the Rpc interface. It is compatible with the JSON
|
|
41
|
+
// JSON generated client.
|
|
42
|
+
request(service, method, contentType, data) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const url = new URL(`/twirp/${service}/${method}`, this.baseUrl).href;
|
|
45
|
+
(0, core_1.debug)(`[Request] ${method} ${url}`);
|
|
46
|
+
const headers = {
|
|
47
|
+
'Content-Type': contentType
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const { body } = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); }));
|
|
51
|
+
return body;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw new Error(`Failed to ${method}: ${error.message}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
retryableRequest(operation) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
let attempt = 0;
|
|
61
|
+
let errorMessage = '';
|
|
62
|
+
let rawBody = '';
|
|
63
|
+
while (attempt < this.maxAttempts) {
|
|
64
|
+
let isRetryable = false;
|
|
65
|
+
try {
|
|
66
|
+
const response = yield operation();
|
|
67
|
+
const statusCode = response.message.statusCode;
|
|
68
|
+
rawBody = yield response.readBody();
|
|
69
|
+
(0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
|
|
70
|
+
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
|
|
71
|
+
const body = JSON.parse(rawBody);
|
|
72
|
+
(0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`);
|
|
73
|
+
if (this.isSuccessStatusCode(statusCode)) {
|
|
74
|
+
return { response, body };
|
|
75
|
+
}
|
|
76
|
+
isRetryable = this.isRetryableHttpStatusCode(statusCode);
|
|
77
|
+
errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
|
|
78
|
+
if (body.msg) {
|
|
79
|
+
if (errors_1.UsageError.isUsageErrorMessage(body.msg)) {
|
|
80
|
+
throw new errors_1.UsageError();
|
|
81
|
+
}
|
|
82
|
+
errorMessage = `${errorMessage}: ${body.msg}`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof SyntaxError) {
|
|
87
|
+
(0, core_1.debug)(`Raw Body: ${rawBody}`);
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
if (error instanceof errors_1.UsageError) {
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
|
|
94
|
+
throw new errors_1.NetworkError(error === null || error === void 0 ? void 0 : error.code);
|
|
95
|
+
}
|
|
96
|
+
isRetryable = true;
|
|
97
|
+
errorMessage = error.message;
|
|
98
|
+
}
|
|
99
|
+
if (!isRetryable) {
|
|
100
|
+
throw new Error(`Received non-retryable error: ${errorMessage}`);
|
|
101
|
+
}
|
|
102
|
+
if (attempt + 1 === this.maxAttempts) {
|
|
103
|
+
throw new Error(`Failed to make request after ${this.maxAttempts} attempts: ${errorMessage}`);
|
|
104
|
+
}
|
|
105
|
+
const retryTimeMilliseconds = this.getExponentialRetryTimeMilliseconds(attempt);
|
|
106
|
+
(0, core_1.info)(`Attempt ${attempt + 1} of ${this.maxAttempts} failed with error: ${errorMessage}. Retrying request in ${retryTimeMilliseconds} ms...`);
|
|
107
|
+
yield this.sleep(retryTimeMilliseconds);
|
|
108
|
+
attempt++;
|
|
109
|
+
}
|
|
110
|
+
throw new Error(`Request failed`);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
isSuccessStatusCode(statusCode) {
|
|
114
|
+
if (!statusCode)
|
|
115
|
+
return false;
|
|
116
|
+
return statusCode >= 200 && statusCode < 300;
|
|
117
|
+
}
|
|
118
|
+
isRetryableHttpStatusCode(statusCode) {
|
|
119
|
+
if (!statusCode)
|
|
120
|
+
return false;
|
|
121
|
+
const retryableStatusCodes = [
|
|
122
|
+
http_client_1.HttpCodes.BadGateway,
|
|
123
|
+
http_client_1.HttpCodes.GatewayTimeout,
|
|
124
|
+
http_client_1.HttpCodes.InternalServerError,
|
|
125
|
+
http_client_1.HttpCodes.ServiceUnavailable,
|
|
126
|
+
http_client_1.HttpCodes.TooManyRequests
|
|
127
|
+
];
|
|
128
|
+
return retryableStatusCodes.includes(statusCode);
|
|
129
|
+
}
|
|
130
|
+
sleep(milliseconds) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
getExponentialRetryTimeMilliseconds(attempt) {
|
|
136
|
+
if (attempt < 0) {
|
|
137
|
+
throw new Error('attempt should be a positive integer');
|
|
138
|
+
}
|
|
139
|
+
if (attempt === 0) {
|
|
140
|
+
return this.baseRetryIntervalMilliseconds;
|
|
141
|
+
}
|
|
142
|
+
const minTime = this.baseRetryIntervalMilliseconds * Math.pow(this.retryMultiplier, attempt);
|
|
143
|
+
const maxTime = minTime * this.retryMultiplier;
|
|
144
|
+
// returns a random number between minTime and maxTime (exclusive)
|
|
145
|
+
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function internalArtifactTwirpClient(options) {
|
|
149
|
+
const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
|
150
|
+
return new generated_1.ArtifactServiceClientJSON(client);
|
|
151
|
+
}
|
|
152
|
+
exports.internalArtifactTwirpClient = internalArtifactTwirpClient;
|
|
153
|
+
//# sourceMappingURL=artifact-twirp-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-twirp-client.js","sourceRoot":"","sources":["../../../src/internal/shared/artifact-twirp-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAA8E;AAC9E,wDAAqE;AACrE,wCAAyC;AACzC,+CAAyD;AACzD,qCAA8D;AAC9D,6CAA+C;AAC/C,qCAAiD;AAYjD,MAAM,kBAAkB;IAOtB,YACE,SAAiB,EACjB,WAAoB,EACpB,6BAAsC,EACtC,eAAwB;QARlB,gBAAW,GAAG,CAAC,CAAA;QACf,kCAA6B,GAAG,IAAI,CAAA;QACpC,oBAAe,GAAG,GAAG,CAAA;QAQ3B,MAAM,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAA,6BAAoB,GAAE,CAAA;QACrC,IAAI,WAAW,EAAE;YACf,IAAI,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
|
|
1
|
+
export declare function getUploadChunkSize(): number;
|
|
2
|
+
export declare function getRuntimeToken(): string;
|
|
3
|
+
export declare function getResultsServiceUrl(): string;
|
|
4
|
+
export declare function isGhes(): boolean;
|
|
5
|
+
export declare function getGitHubWorkspaceDir(): string;
|
|
6
|
+
export declare function getConcurrency(): number;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0;
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
// Used for controlling the highWaterMark value of the zip that is being streamed
|
|
9
|
+
// The same value is used as the chunk size that is use during upload to blob storage
|
|
10
|
+
function getUploadChunkSize() {
|
|
11
|
+
return 8 * 1024 * 1024; // 8 MB Chunks
|
|
12
|
+
}
|
|
13
|
+
exports.getUploadChunkSize = getUploadChunkSize;
|
|
14
|
+
function getRuntimeToken() {
|
|
15
|
+
const token = process.env['ACTIONS_RUNTIME_TOKEN'];
|
|
16
|
+
if (!token) {
|
|
17
|
+
throw new Error('Unable to get the ACTIONS_RUNTIME_TOKEN env variable');
|
|
18
|
+
}
|
|
19
|
+
return token;
|
|
20
|
+
}
|
|
21
|
+
exports.getRuntimeToken = getRuntimeToken;
|
|
22
|
+
function getResultsServiceUrl() {
|
|
23
|
+
const resultsUrl = process.env['ACTIONS_RESULTS_URL'];
|
|
24
|
+
if (!resultsUrl) {
|
|
25
|
+
throw new Error('Unable to get the ACTIONS_RESULTS_URL env variable');
|
|
26
|
+
}
|
|
27
|
+
return new URL(resultsUrl).origin;
|
|
28
|
+
}
|
|
29
|
+
exports.getResultsServiceUrl = getResultsServiceUrl;
|
|
30
|
+
function isGhes() {
|
|
31
|
+
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
|
32
|
+
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
|
33
|
+
}
|
|
34
|
+
exports.isGhes = isGhes;
|
|
35
|
+
function getGitHubWorkspaceDir() {
|
|
36
|
+
const ghWorkspaceDir = process.env['GITHUB_WORKSPACE'];
|
|
37
|
+
if (!ghWorkspaceDir) {
|
|
38
|
+
throw new Error('Unable to get the GITHUB_WORKSPACE env variable');
|
|
39
|
+
}
|
|
40
|
+
return ghWorkspaceDir;
|
|
41
|
+
}
|
|
42
|
+
exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir;
|
|
43
|
+
// Mimics behavior of azcopy: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-optimize
|
|
44
|
+
// If your machine has fewer than 5 CPUs, then the value of this variable is set to 32.
|
|
45
|
+
// Otherwise, the default value is equal to 16 multiplied by the number of CPUs. The maximum value of this variable is 300.
|
|
46
|
+
function getConcurrency() {
|
|
47
|
+
const numCPUs = os_1.default.cpus().length;
|
|
48
|
+
if (numCPUs <= 4) {
|
|
49
|
+
return 32;
|
|
50
|
+
}
|
|
51
|
+
const concurrency = 16 * numCPUs;
|
|
52
|
+
return concurrency > 300 ? 300 : concurrency;
|
|
53
|
+
}
|
|
54
|
+
exports.getConcurrency = getConcurrency;
|
|
55
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/internal/shared/config.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AAEnB,iFAAiF;AACjF,qFAAqF;AACrF,SAAgB,kBAAkB;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,cAAc;AACvC,CAAC;AAFD,gDAEC;AAED,SAAgB,eAAe;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,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
1
|
+
export declare class FilesNotFoundError extends Error {
|
|
2
|
+
files: string[];
|
|
3
|
+
constructor(files?: string[]);
|
|
4
|
+
}
|
|
5
|
+
export declare class InvalidResponseError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class ArtifactNotFoundError extends Error {
|
|
9
|
+
constructor(message?: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class GHESNotSupportedError extends Error {
|
|
12
|
+
constructor(message?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class NetworkError extends Error {
|
|
15
|
+
code: string;
|
|
16
|
+
constructor(code: string);
|
|
17
|
+
static isNetworkErrorCode: (code?: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class UsageError extends Error {
|
|
20
|
+
constructor();
|
|
21
|
+
static isUsageErrorMessage: (msg?: string) => boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.ArtifactNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
|
|
4
|
+
class FilesNotFoundError extends Error {
|
|
5
|
+
constructor(files = []) {
|
|
6
|
+
let message = 'No files were found to upload';
|
|
7
|
+
if (files.length > 0) {
|
|
8
|
+
message += `: ${files.join(', ')}`;
|
|
9
|
+
}
|
|
10
|
+
super(message);
|
|
11
|
+
this.files = files;
|
|
12
|
+
this.name = 'FilesNotFoundError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.FilesNotFoundError = FilesNotFoundError;
|
|
16
|
+
class InvalidResponseError extends Error {
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'InvalidResponseError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.InvalidResponseError = InvalidResponseError;
|
|
23
|
+
class ArtifactNotFoundError extends Error {
|
|
24
|
+
constructor(message = 'Artifact not found') {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'ArtifactNotFoundError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ArtifactNotFoundError = ArtifactNotFoundError;
|
|
30
|
+
class GHESNotSupportedError extends Error {
|
|
31
|
+
constructor(message = '@actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.') {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = 'GHESNotSupportedError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.GHESNotSupportedError = GHESNotSupportedError;
|
|
37
|
+
class NetworkError extends Error {
|
|
38
|
+
constructor(code) {
|
|
39
|
+
const message = `Unable to make request: ${code}\nIf you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github`;
|
|
40
|
+
super(message);
|
|
41
|
+
this.code = code;
|
|
42
|
+
this.name = 'NetworkError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.NetworkError = NetworkError;
|
|
46
|
+
NetworkError.isNetworkErrorCode = (code) => {
|
|
47
|
+
if (!code)
|
|
48
|
+
return false;
|
|
49
|
+
return [
|
|
50
|
+
'ECONNRESET',
|
|
51
|
+
'ENOTFOUND',
|
|
52
|
+
'ETIMEDOUT',
|
|
53
|
+
'ECONNREFUSED',
|
|
54
|
+
'EHOSTUNREACH'
|
|
55
|
+
].includes(code);
|
|
56
|
+
};
|
|
57
|
+
class UsageError extends Error {
|
|
58
|
+
constructor() {
|
|
59
|
+
const message = `Artifact storage quota has been hit. Unable to upload any new artifacts. Usage is recalculated every 6-12 hours.\nMore info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`;
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = 'UsageError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.UsageError = UsageError;
|
|
65
|
+
UsageError.isUsageErrorMessage = (msg) => {
|
|
66
|
+
if (!msg)
|
|
67
|
+
return false;
|
|
68
|
+
return msg.includes('insufficient usage');
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/internal/shared/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAmB,SAAQ,KAAK;IAG3C,YAAY,QAAkB,EAAE;QAC9B,IAAI,OAAO,GAAG,+BAA+B,CAAA;QAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,OAAO,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;SACnC;QAED,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,CAAC;CACF;AAbD,gDAaC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;IACpC,CAAC;CACF;AALD,oDAKC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,GAAG,oBAAoB;QACxC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AALD,sDAKC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YACE,OAAO,GAAG,+GAA+G;QAEzH,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AAPD,sDAOC;AAED,MAAa,YAAa,SAAQ,KAAK;IAGrC,YAAY,IAAY;QACtB,MAAM,OAAO,GAAG,2BAA2B,IAAI,kRAAkR,CAAA;QACjU,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC5B,CAAC;;AARH,oCAoBC;AAVQ,+BAAkB,GAAG,CAAC,IAAa,EAAW,EAAE;IACrD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACvB,OAAO;QACL,YAAY;QACZ,WAAW;QACX,WAAW;QACX,cAAc;QACd,cAAc;KACf,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAClB,CAAC,CAAA;AAGH,MAAa,UAAW,SAAQ,KAAK;IACnC;QACE,MAAM,OAAO,GAAG,gSAAgS,CAAA;QAChT,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;;AALH,gCAWC;AAJQ,8BAAmB,GAAG,CAAC,GAAY,EAAW,EAAE;IACrD,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAA;IACtB,OAAO,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response from the server when an artifact is uploaded
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadArtifactResponse {
|
|
5
|
+
/**
|
|
6
|
+
* Total size of the artifact in bytes. Not provided if no artifact was uploaded
|
|
7
|
+
*/
|
|
8
|
+
size?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The id of the artifact that was created. Not provided if no artifact was uploaded
|
|
11
|
+
* This ID can be used as input to other APIs to download, delete or get more information about an artifact: https://docs.github.com/en/rest/actions/artifacts
|
|
12
|
+
*/
|
|
13
|
+
id?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Options for uploading an artifact
|
|
17
|
+
*/
|
|
18
|
+
export interface UploadArtifactOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Duration after which artifact will expire in days.
|
|
21
|
+
*
|
|
22
|
+
* By default artifact expires after 90 days:
|
|
23
|
+
* https://docs.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#downloading-and-deleting-artifacts-after-a-workflow-run-is-complete
|
|
24
|
+
*
|
|
25
|
+
* Use this option to override the default expiry.
|
|
26
|
+
*
|
|
27
|
+
* Min value: 1
|
|
28
|
+
* Max value: 90 unless changed by repository setting
|
|
29
|
+
*
|
|
30
|
+
* If this is set to a greater value than the retention settings allowed, the retention on artifacts
|
|
31
|
+
* will be reduced to match the max value allowed on server, and the upload process will continue. An
|
|
32
|
+
* input of 0 assumes default retention setting.
|
|
33
|
+
*/
|
|
34
|
+
retentionDays?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The level of compression for Zlib to be applied to the artifact archive.
|
|
37
|
+
* The value can range from 0 to 9:
|
|
38
|
+
* - 0: No compression
|
|
39
|
+
* - 1: Best speed
|
|
40
|
+
* - 6: Default compression (same as GNU Gzip)
|
|
41
|
+
* - 9: Best compression
|
|
42
|
+
* Higher levels will result in better compression, but will take longer to complete.
|
|
43
|
+
* For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
|
|
44
|
+
*/
|
|
45
|
+
compressionLevel?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Response from the server when getting an artifact
|
|
49
|
+
*/
|
|
50
|
+
export interface GetArtifactResponse {
|
|
51
|
+
/**
|
|
52
|
+
* Metadata about the artifact that was found
|
|
53
|
+
*/
|
|
54
|
+
artifact: Artifact;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Options for listing artifacts
|
|
58
|
+
*/
|
|
59
|
+
export interface ListArtifactsOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Filter the workflow run's artifacts to the latest by name
|
|
62
|
+
* In the case of reruns, this can be useful to avoid duplicates
|
|
63
|
+
*/
|
|
64
|
+
latest?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Response from the server when listing artifacts
|
|
68
|
+
*/
|
|
69
|
+
export interface ListArtifactsResponse {
|
|
70
|
+
/**
|
|
71
|
+
* A list of artifacts that were found
|
|
72
|
+
*/
|
|
73
|
+
artifacts: Artifact[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Response from the server when downloading an artifact
|
|
77
|
+
*/
|
|
78
|
+
export interface DownloadArtifactResponse {
|
|
79
|
+
/**
|
|
80
|
+
* The path where the artifact was downloaded to
|
|
81
|
+
*/
|
|
82
|
+
downloadPath?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Options for downloading an artifact
|
|
86
|
+
*/
|
|
87
|
+
export interface DownloadArtifactOptions {
|
|
88
|
+
/**
|
|
89
|
+
* Denotes where the artifact will be downloaded to. If not specified then the artifact is download to GITHUB_WORKSPACE
|
|
90
|
+
*/
|
|
91
|
+
path?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* An Actions Artifact
|
|
95
|
+
*/
|
|
96
|
+
export interface Artifact {
|
|
97
|
+
/**
|
|
98
|
+
* The name of the artifact
|
|
99
|
+
*/
|
|
100
|
+
name: string;
|
|
101
|
+
/**
|
|
102
|
+
* The ID of the artifact
|
|
103
|
+
*/
|
|
104
|
+
id: number;
|
|
105
|
+
/**
|
|
106
|
+
* The size of the artifact in bytes
|
|
107
|
+
*/
|
|
108
|
+
size: number;
|
|
109
|
+
/**
|
|
110
|
+
* The time when the artifact was created
|
|
111
|
+
*/
|
|
112
|
+
createdAt?: Date;
|
|
113
|
+
}
|
|
114
|
+
export interface FindOptions {
|
|
115
|
+
/**
|
|
116
|
+
* The criteria for finding Artifact(s) out of the scope of the current run.
|
|
117
|
+
*/
|
|
118
|
+
findBy?: {
|
|
119
|
+
/**
|
|
120
|
+
* Token with actions:read permissions
|
|
121
|
+
*/
|
|
122
|
+
token: string;
|
|
123
|
+
/**
|
|
124
|
+
* WorkflowRun of the artifact(s) to lookup
|
|
125
|
+
*/
|
|
126
|
+
workflowRunId: number;
|
|
127
|
+
/**
|
|
128
|
+
* Repository owner (eg. 'actions')
|
|
129
|
+
*/
|
|
130
|
+
repositoryOwner: string;
|
|
131
|
+
/**
|
|
132
|
+
* Repository owner (eg. 'toolkit')
|
|
133
|
+
*/
|
|
134
|
+
repositoryName: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/internal/shared/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserAgentString = void 0;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
5
|
+
const packageJson = require('../../../package.json');
|
|
6
|
+
/**
|
|
7
|
+
* Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package
|
|
8
|
+
*/
|
|
9
|
+
function getUserAgentString() {
|
|
10
|
+
return `@actions/artifact-${packageJson.version}`;
|
|
11
|
+
}
|
|
12
|
+
exports.getUserAgentString = getUserAgentString;
|
|
13
|
+
//# sourceMappingURL=user-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-agent.js","sourceRoot":"","sources":["../../../src/internal/shared/user-agent.ts"],"names":[],"mappings":";;;AAAA,qGAAqG;AACrG,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAEpD;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO,qBAAqB,WAAW,CAAC,OAAO,EAAE,CAAA;AACnD,CAAC;AAFD,gDAEC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.getBackendIdsFromToken = void 0;
|
|
30
|
+
const core = __importStar(require("@actions/core"));
|
|
31
|
+
const config_1 = require("./config");
|
|
32
|
+
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
33
|
+
const InvalidJwtError = new Error('Failed to get backend IDs: The provided JWT token is invalid and/or missing claims');
|
|
34
|
+
// uses the JWT token claims to get the
|
|
35
|
+
// workflow run and workflow job run backend ids
|
|
36
|
+
function getBackendIdsFromToken() {
|
|
37
|
+
const token = (0, config_1.getRuntimeToken)();
|
|
38
|
+
const decoded = (0, jwt_decode_1.default)(token);
|
|
39
|
+
if (!decoded.scp) {
|
|
40
|
+
throw InvalidJwtError;
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
* example decoded:
|
|
44
|
+
* {
|
|
45
|
+
* scp: "Actions.ExampleScope Actions.Results:ce7f54c7-61c7-4aae-887f-30da475f5f1a:ca395085-040a-526b-2ce8-bdc85f692774"
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
const scpParts = decoded.scp.split(' ');
|
|
49
|
+
if (scpParts.length === 0) {
|
|
50
|
+
throw InvalidJwtError;
|
|
51
|
+
}
|
|
52
|
+
/*
|
|
53
|
+
* example scpParts:
|
|
54
|
+
* ["Actions.ExampleScope", "Actions.Results:ce7f54c7-61c7-4aae-887f-30da475f5f1a:ca395085-040a-526b-2ce8-bdc85f692774"]
|
|
55
|
+
*/
|
|
56
|
+
for (const scopes of scpParts) {
|
|
57
|
+
const scopeParts = scopes.split(':');
|
|
58
|
+
if ((scopeParts === null || scopeParts === void 0 ? void 0 : scopeParts[0]) !== 'Actions.Results') {
|
|
59
|
+
// not the Actions.Results scope
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
/*
|
|
63
|
+
* example scopeParts:
|
|
64
|
+
* ["Actions.Results", "ce7f54c7-61c7-4aae-887f-30da475f5f1a", "ca395085-040a-526b-2ce8-bdc85f692774"]
|
|
65
|
+
*/
|
|
66
|
+
if (scopeParts.length !== 3) {
|
|
67
|
+
// missing expected number of claims
|
|
68
|
+
throw InvalidJwtError;
|
|
69
|
+
}
|
|
70
|
+
const ids = {
|
|
71
|
+
workflowRunBackendId: scopeParts[1],
|
|
72
|
+
workflowJobRunBackendId: scopeParts[2]
|
|
73
|
+
};
|
|
74
|
+
core.debug(`Workflow Run Backend ID: ${ids.workflowRunBackendId}`);
|
|
75
|
+
core.debug(`Workflow Job Run Backend ID: ${ids.workflowJobRunBackendId}`);
|
|
76
|
+
return ids;
|
|
77
|
+
}
|
|
78
|
+
throw InvalidJwtError;
|
|
79
|
+
}
|
|
80
|
+
exports.getBackendIdsFromToken = getBackendIdsFromToken;
|
|
81
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/internal/shared/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,qCAAwC;AACxC,4DAAmC;AAWnC,MAAM,eAAe,GAAG,IAAI,KAAK,CAC/B,oFAAoF,CACrF,CAAA;AAED,uCAAuC;AACvC,gDAAgD;AAChD,SAAgB,sBAAsB;IACpC,MAAM,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAA;IAC/B,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAe,KAAK,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAChB,MAAM,eAAe,CAAA;KACtB;IAED;;;;;OAKG;IAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,MAAM,eAAe,CAAA;KACtB;IACD;;;OAGG;IAEH,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,CAAC,CAAC,MAAK,iBAAiB,EAAE;YACzC,gCAAgC;YAChC,SAAQ;SACT;QAED;;;WAGG;QACH,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,oCAAoC;YACpC,MAAM,eAAe,CAAA;SACtB;QAED,MAAM,GAAG,GAAG;YACV,oBAAoB,EAAE,UAAU,CAAC,CAAC,CAAC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