From bd99d4532148bb9877a2906258e70f780638dc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20So=C5=82tys?= <74361703+Sawthis@users.noreply.github.com> Date: Thu, 4 Apr 2024 08:21:41 +0000 Subject: [PATCH] Use Javascript Github action --- .github/actions/expose-jwt-action/action.yml | 7 +++++-- .github/actions/expose-jwt-action/index.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/actions/expose-jwt-action/action.yml b/.github/actions/expose-jwt-action/action.yml index b5272b61eb95..d921171578de 100644 --- a/.github/actions/expose-jwt-action/action.yml +++ b/.github/actions/expose-jwt-action/action.yml @@ -8,7 +8,7 @@ inputs: outputs: jwt: # id of output description: 'The signed JWT ID Token' - value: ${{ steps.random-number-generator.outputs.random-number }} + value: ${{ steps.expose-jwt.outputs.jwt }} runs: using: "composite" steps: @@ -22,7 +22,10 @@ runs: cd .github/actions/expose-jwt-action npm init -y npm install @actions/core - node index.js shell: bash env: INPUT_AUDIENCE: ${{ inputs.audience }} + - uses: .github/actions/expose-jwt-action + id: expose-jwt + - run: echo "JWT in bash $UTPUT_JWT." + shell: bash diff --git a/.github/actions/expose-jwt-action/index.js b/.github/actions/expose-jwt-action/index.js index c1e81d279cb4..36695a31145b 100644 --- a/.github/actions/expose-jwt-action/index.js +++ b/.github/actions/expose-jwt-action/index.js @@ -3,11 +3,11 @@ const core = require('@actions/core'); async function run() { try { // Get aud and request token - const audience = process.env.NPUT_AUDIENCE; + const audience = core.getInput('audience'); console.log(`audience in javascript ${audience}`); const jwt = await core.getIDToken(audience); core.setOutput("jwt", jwt); - core.exportVariable('JWT', jwt); + core.exportVariable('OUTPUT_JWT', jwt); } catch (error) { core.setFailed(error.message); }