github: printActionsRuntimeToken

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-02-03 03:33:22 +01:00
parent 40e9a15129
commit ad59af8cf2
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
2 changed files with 41 additions and 0 deletions

View file

@ -15,6 +15,7 @@
*/
import {GitHub as Octokit} from '@actions/github/lib/utils';
import * as core from '@actions/core';
import * as github from '@actions/github';
import {Context} from '@actions/github/lib/context';
import jwt_decode from 'jwt-decode';
@ -52,4 +53,13 @@ export class GitHub {
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
return token ? jwt_decode<GitHubActionsRuntimeToken>(token) : {};
}
public static async printActionsRuntimeToken() {
const actionsRuntimeToken = process.env['ACTIONS_RUNTIME_TOKEN'];
if (actionsRuntimeToken) {
core.info(JSON.stringify(JSON.parse(GitHub.actionsRuntimeToken.ac as string), undefined, 2));
} else {
core.info(`ACTIONS_RUNTIME_TOKEN not set`);
}
}
}