Skip to content

Commit 931d840

Browse files
committed
@actions/core to 1.6.0
1 parent 71fc3a7 commit 931d840

File tree

4 files changed

+184
-22
lines changed

4 files changed

+184
-22
lines changed

dist/index.js

Lines changed: 174 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
771771
});
772772
};
773773
Object.defineProperty(exports, "__esModule", ({ value: true }));
774-
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
774+
exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
775775
const command_1 = __nccwpck_require__(338);
776776
const file_command_1 = __nccwpck_require__(550);
777777
const utils_1 = __nccwpck_require__(412);
778778
const os = __importStar(__nccwpck_require__(87));
779779
const path = __importStar(__nccwpck_require__(622));
780+
const oidc_utils_1 = __nccwpck_require__(370);
780781
/**
781782
* The code to exit an action
782783
*/
@@ -1045,6 +1046,12 @@ function getState(name) {
10451046
return process.env[`STATE_${name}`] || '';
10461047
}
10471048
exports.getState = getState;
1049+
function getIDToken(aud) {
1050+
return __awaiter(this, void 0, void 0, function* () {
1051+
return yield oidc_utils_1.OidcClient.getIDToken(aud);
1052+
});
1053+
}
1054+
exports.getIDToken = getIDToken;
10481055
//# sourceMappingURL=core.js.map
10491056

10501057
/***/ }),
@@ -1098,6 +1105,90 @@ exports.issueCommand = issueCommand;
10981105

10991106
/***/ }),
11001107

1108+
/***/ 370:
1109+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1110+
1111+
"use strict";
1112+
1113+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1114+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1115+
return new (P || (P = Promise))(function (resolve, reject) {
1116+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1117+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1118+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1119+
step((generator = generator.apply(thisArg, _arguments || [])).next());
1120+
});
1121+
};
1122+
Object.defineProperty(exports, "__esModule", ({ value: true }));
1123+
exports.OidcClient = void 0;
1124+
const http_client_1 = __nccwpck_require__(666);
1125+
const auth_1 = __nccwpck_require__(34);
1126+
const core_1 = __nccwpck_require__(948);
1127+
class OidcClient {
1128+
static createHttpClient(allowRetry = true, maxRetry = 10) {
1129+
const requestOptions = {
1130+
allowRetries: allowRetry,
1131+
maxRetries: maxRetry
1132+
};
1133+
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
1134+
}
1135+
static getRequestToken() {
1136+
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
1137+
if (!token) {
1138+
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
1139+
}
1140+
return token;
1141+
}
1142+
static getIDTokenUrl() {
1143+
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
1144+
if (!runtimeUrl) {
1145+
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
1146+
}
1147+
return runtimeUrl;
1148+
}
1149+
static getCall(id_token_url) {
1150+
var _a;
1151+
return __awaiter(this, void 0, void 0, function* () {
1152+
const httpclient = OidcClient.createHttpClient();
1153+
const res = yield httpclient
1154+
.getJson(id_token_url)
1155+
.catch(error => {
1156+
throw new Error(`Failed to get ID Token. \n
1157+
Error Code : ${error.statusCode}\n
1158+
Error Message: ${error.result.message}`);
1159+
});
1160+
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
1161+
if (!id_token) {
1162+
throw new Error('Response json body do not have ID Token field');
1163+
}
1164+
return id_token;
1165+
});
1166+
}
1167+
static getIDToken(audience) {
1168+
return __awaiter(this, void 0, void 0, function* () {
1169+
try {
1170+
// New ID Token is requested from action service
1171+
let id_token_url = OidcClient.getIDTokenUrl();
1172+
if (audience) {
1173+
const encodedAudience = encodeURIComponent(audience);
1174+
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
1175+
}
1176+
core_1.debug(`ID token url is ${id_token_url}`);
1177+
const id_token = yield OidcClient.getCall(id_token_url);
1178+
core_1.setSecret(id_token);
1179+
return id_token;
1180+
}
1181+
catch (error) {
1182+
throw new Error(`Error message: ${error.message}`);
1183+
}
1184+
});
1185+
}
1186+
}
1187+
exports.OidcClient = OidcClient;
1188+
//# sourceMappingURL=oidc-utils.js.map
1189+
1190+
/***/ }),
1191+
11011192
/***/ 412:
11021193
/***/ ((__unused_webpack_module, exports) => {
11031194

@@ -1133,6 +1224,7 @@ function toCommandProperties(annotationProperties) {
11331224
}
11341225
return {
11351226
title: annotationProperties.title,
1227+
file: annotationProperties.file,
11361228
line: annotationProperties.startLine,
11371229
endLine: annotationProperties.endLine,
11381230
col: annotationProperties.startColumn,
@@ -1142,6 +1234,72 @@ function toCommandProperties(annotationProperties) {
11421234
exports.toCommandProperties = toCommandProperties;
11431235
//# sourceMappingURL=utils.js.map
11441236

1237+
/***/ }),
1238+
1239+
/***/ 34:
1240+
/***/ ((__unused_webpack_module, exports) => {
1241+
1242+
"use strict";
1243+
1244+
Object.defineProperty(exports, "__esModule", ({ value: true }));
1245+
class BasicCredentialHandler {
1246+
constructor(username, password) {
1247+
this.username = username;
1248+
this.password = password;
1249+
}
1250+
prepareRequest(options) {
1251+
options.headers['Authorization'] =
1252+
'Basic ' +
1253+
Buffer.from(this.username + ':' + this.password).toString('base64');
1254+
}
1255+
// This handler cannot handle 401
1256+
canHandleAuthentication(response) {
1257+
return false;
1258+
}
1259+
handleAuthentication(httpClient, requestInfo, objs) {
1260+
return null;
1261+
}
1262+
}
1263+
exports.BasicCredentialHandler = BasicCredentialHandler;
1264+
class BearerCredentialHandler {
1265+
constructor(token) {
1266+
this.token = token;
1267+
}
1268+
// currently implements pre-authorization
1269+
// TODO: support preAuth = false where it hooks on 401
1270+
prepareRequest(options) {
1271+
options.headers['Authorization'] = 'Bearer ' + this.token;
1272+
}
1273+
// This handler cannot handle 401
1274+
canHandleAuthentication(response) {
1275+
return false;
1276+
}
1277+
handleAuthentication(httpClient, requestInfo, objs) {
1278+
return null;
1279+
}
1280+
}
1281+
exports.BearerCredentialHandler = BearerCredentialHandler;
1282+
class PersonalAccessTokenCredentialHandler {
1283+
constructor(token) {
1284+
this.token = token;
1285+
}
1286+
// currently implements pre-authorization
1287+
// TODO: support preAuth = false where it hooks on 401
1288+
prepareRequest(options) {
1289+
options.headers['Authorization'] =
1290+
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
1291+
}
1292+
// This handler cannot handle 401
1293+
canHandleAuthentication(response) {
1294+
return false;
1295+
}
1296+
handleAuthentication(httpClient, requestInfo, objs) {
1297+
return null;
1298+
}
1299+
}
1300+
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
1301+
1302+
11451303
/***/ }),
11461304

11471305
/***/ 666:
@@ -2065,95 +2223,95 @@ const old_pkgs = {
20652223
/***/ ((module) => {
20662224

20672225
"use strict";
2068-
module.exports = require("assert");;
2226+
module.exports = require("assert");
20692227

20702228
/***/ }),
20712229

20722230
/***/ 129:
20732231
/***/ ((module) => {
20742232

20752233
"use strict";
2076-
module.exports = require("child_process");;
2234+
module.exports = require("child_process");
20772235

20782236
/***/ }),
20792237

20802238
/***/ 614:
20812239
/***/ ((module) => {
20822240

20832241
"use strict";
2084-
module.exports = require("events");;
2242+
module.exports = require("events");
20852243

20862244
/***/ }),
20872245

20882246
/***/ 747:
20892247
/***/ ((module) => {
20902248

20912249
"use strict";
2092-
module.exports = require("fs");;
2250+
module.exports = require("fs");
20932251

20942252
/***/ }),
20952253

20962254
/***/ 605:
20972255
/***/ ((module) => {
20982256

20992257
"use strict";
2100-
module.exports = require("http");;
2258+
module.exports = require("http");
21012259

21022260
/***/ }),
21032261

21042262
/***/ 211:
21052263
/***/ ((module) => {
21062264

21072265
"use strict";
2108-
module.exports = require("https");;
2266+
module.exports = require("https");
21092267

21102268
/***/ }),
21112269

21122270
/***/ 631:
21132271
/***/ ((module) => {
21142272

21152273
"use strict";
2116-
module.exports = require("net");;
2274+
module.exports = require("net");
21172275

21182276
/***/ }),
21192277

21202278
/***/ 87:
21212279
/***/ ((module) => {
21222280

21232281
"use strict";
2124-
module.exports = require("os");;
2282+
module.exports = require("os");
21252283

21262284
/***/ }),
21272285

21282286
/***/ 622:
21292287
/***/ ((module) => {
21302288

21312289
"use strict";
2132-
module.exports = require("path");;
2290+
module.exports = require("path");
21332291

21342292
/***/ }),
21352293

21362294
/***/ 630:
21372295
/***/ ((module) => {
21382296

21392297
"use strict";
2140-
module.exports = require("perf_hooks");;
2298+
module.exports = require("perf_hooks");
21412299

21422300
/***/ }),
21432301

21442302
/***/ 16:
21452303
/***/ ((module) => {
21462304

21472305
"use strict";
2148-
module.exports = require("tls");;
2306+
module.exports = require("tls");
21492307

21502308
/***/ }),
21512309

21522310
/***/ 669:
21532311
/***/ ((module) => {
21542312

21552313
"use strict";
2156-
module.exports = require("util");;
2314+
module.exports = require("util");
21572315

21582316
/***/ })
21592317

@@ -2220,7 +2378,9 @@ module.exports = require("util");;
22202378
/******/
22212379
/******/ /* webpack/runtime/compat */
22222380
/******/
2223-
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
2381+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
2382+
/******/
2383+
/************************************************************************/
22242384
var __webpack_exports__ = {};
22252385
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
22262386
(() => {

dist/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.29.2",
3+
"version": "1.30.0",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"author": "MSP-Greg",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/core": "^1.5.0",
26+
"@actions/core": "^1.6.0",
2727
"@actions/http-client": "^1.0.11"
2828
}
2929
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.29.2",
3+
"version": "1.30.0",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"author": "MSP-Greg",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/core": "^1.5.0",
26+
"@actions/core": "^1.6.0",
2727
"@actions/http-client": "^1.0.11"
2828
}
2929
}

yarn.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
# yarn lockfile v1
33

44

5-
"@actions/core@^1.5.0":
6-
version "1.5.0"
7-
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.5.0.tgz#885b864700001a1b9a6fba247833a036e75ad9d3"
8-
integrity sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ==
5+
"@actions/core@^1.6.0":
6+
version "1.6.0"
7+
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.6.0.tgz#0568e47039bfb6a9170393a73f3b7eb3b22462cb"
8+
integrity sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==
9+
dependencies:
10+
"@actions/http-client" "^1.0.11"
911

1012
"@actions/http-client@^1.0.11":
1113
version "1.0.11"

0 commit comments

Comments
 (0)