mirror of https://github.com/actions/toolkit
addressed comments
parent
1c86c4c890
commit
22e5d95310
|
@ -227,11 +227,8 @@ In action's `main.ts`:
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
async function getIDTokenAction(): Promise<void> {
|
async function getIDTokenAction(): Promise<void> {
|
||||||
|
|
||||||
let aud = ''
|
|
||||||
const audience = core.getInput('audience', {required: false})
|
const audience = core.getInput('audience', {required: false})
|
||||||
if (audience !== undefined)
|
const id_token = await core.getIDToken(audience)
|
||||||
aud = `${audience}`
|
|
||||||
const id_token = await core.getIDToken(aud)
|
|
||||||
core.setOutput('id_token', id_token)
|
core.setOutput('id_token', id_token)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,11 @@ interface TokenResponse {
|
||||||
export class OidcClient {
|
export class OidcClient {
|
||||||
|
|
||||||
private static createHttpClient(allowRetry = true, maxRetry = 10) {
|
private static createHttpClient(allowRetry = true, maxRetry = 10) {
|
||||||
let requestOptions : IRequestOptions = {}
|
let requestOptions : IRequestOptions = {
|
||||||
requestOptions.allowRetries = allowRetry
|
allowRetries: allowRetry,
|
||||||
requestOptions.maxRetries = maxRetry
|
maxRetries: maxRetry
|
||||||
|
}
|
||||||
|
|
||||||
return new HttpClient('actions/oidc-client', [
|
return new HttpClient('actions/oidc-client', [
|
||||||
new BearerCredentialHandler(OidcClient.getRuntimeToken())],
|
new BearerCredentialHandler(OidcClient.getRuntimeToken())],
|
||||||
requestOptions)
|
requestOptions)
|
||||||
|
@ -45,7 +47,7 @@ export class OidcClient {
|
||||||
|
|
||||||
private static async postCall(httpclient: actions_http_client.HttpClient, id_token_url: string, audience: string): Promise<string> {
|
private static async postCall(httpclient: actions_http_client.HttpClient, id_token_url: string, audience: string): Promise<string> {
|
||||||
|
|
||||||
const data :TokenRequest = { aud: !!audience ? audience : ''}
|
const data: TokenRequest = { aud: audience }
|
||||||
|
|
||||||
debug(`audience is ${!!audience ? audience : 'not defined'}`)
|
debug(`audience is ${!!audience ? audience : 'not defined'}`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue