mirror of https://github.com/actions/toolkit
null ref fix
parent
f541fb1ac9
commit
7965cc3c7d
|
@ -116,7 +116,7 @@ function getIDToken(audience) {
|
||||||
try {
|
try {
|
||||||
//Check if id token is stored in environment variable
|
//Check if id token is stored in environment variable
|
||||||
let id_token = config_variables_1.getIDTokenFromEnv();
|
let id_token = config_variables_1.getIDTokenFromEnv();
|
||||||
if (id_token !== undefined) {
|
if (id_token !== undefined && id_token !== '') {
|
||||||
const secondsSinceEpoch = Math.round(Date.now() / 1000);
|
const secondsSinceEpoch = Math.round(Date.now() / 1000);
|
||||||
const id_token_json = jwt_decode_1.default(id_token);
|
const id_token_json = jwt_decode_1.default(id_token);
|
||||||
if ('exp' in id_token_json) {
|
if ('exp' in id_token_json) {
|
||||||
|
@ -167,7 +167,7 @@ function getIDToken(audience) {
|
||||||
}
|
}
|
||||||
exports.getIDToken = getIDToken;
|
exports.getIDToken = getIDToken;
|
||||||
//module.exports.getIDToken = getIDToken
|
//module.exports.getIDToken = getIDToken
|
||||||
//getIDToken('ghactions')
|
getIDToken('ghactions');
|
||||||
//# sourceMappingURL=main.js.map
|
//# sourceMappingURL=main.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@sourav_chanduka/oidc-client",
|
"name": "@sourav_chanduka/oidc-client",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@sourav_chanduka/oidc-client",
|
"name": "@sourav_chanduka/oidc-client",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@sourav_chanduka/oidc-client",
|
"name": "@sourav_chanduka/oidc-client",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"description": "To get id token from oidc provider",
|
"description": "To get id token from oidc provider",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"types": "lib/main.d.ts",
|
"types": "lib/main.d.ts",
|
||||||
|
|
|
@ -13,7 +13,7 @@ export async function getIDToken(audience: string): Promise<string> {
|
||||||
//Check if id token is stored in environment variable
|
//Check if id token is stored in environment variable
|
||||||
|
|
||||||
let id_token: string = getIDTokenFromEnv()
|
let id_token: string = getIDTokenFromEnv()
|
||||||
if (id_token !== undefined) {
|
if (id_token !== undefined && id_token !== '') {
|
||||||
const secondsSinceEpoch = Math.round(Date.now() / 1000)
|
const secondsSinceEpoch = Math.round(Date.now() / 1000)
|
||||||
const id_token_json: any = jwt_decode(id_token)
|
const id_token_json: any = jwt_decode(id_token)
|
||||||
if ('exp' in id_token_json) {
|
if ('exp' in id_token_json) {
|
||||||
|
@ -80,4 +80,4 @@ export async function getIDToken(audience: string): Promise<string> {
|
||||||
|
|
||||||
//module.exports.getIDToken = getIDToken
|
//module.exports.getIDToken = getIDToken
|
||||||
|
|
||||||
//getIDToken('ghactions')
|
getIDToken('ghactions')
|
||||||
|
|
Loading…
Reference in New Issue