From 1f8d7b5a6493ba3948cf22d0129f56929ef18096 Mon Sep 17 00:00:00 2001 From: Sourav Chanduka Date: Wed, 18 Aug 2021 16:53:54 +0530 Subject: [PATCH] default aud parameter --- packages/core/README.md | 8 ++++++-- packages/core/src/core.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 75061315..da15e5ef 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -278,7 +278,9 @@ const core = require('@actions/core'); async function getIDTokenAction(): Promise { const audience = core.getInput('audience', {required: false}) - const id_token = await core.getIDToken(audience) + + const id_token1 = await core.getIDToken() // ID Token with default audience + const id_token2 = await core.getIDToken(audience) // ID token with custom audience // this id_token can be used to get access token from third party cloud providers } @@ -295,7 +297,9 @@ inputs: description: 'Audience for which the ID token is intended for' required: false outputs: - id_token: + id_token1: + description: 'ID token obtained from OIDC provider' + id_token2: description: 'ID token obtained from OIDC provider' runs: using: 'node12' diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 4b594b83..f03b577e 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -351,6 +351,6 @@ export function getState(name: string): string { return process.env[`STATE_${name}`] || '' } -export async function getIDToken(aud = undefined): Promise { +export async function getIDToken(aud: string | undefined = undefined): Promise { return await OidcClient.getIDToken(aud) } \ No newline at end of file