From e7cc33a01bc1b1df406bac8a1c4a409a34bdca0a Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Sun, 1 Dec 2024 15:49:52 +0200 Subject: [PATCH] New OIDC fields added, including the GitHub job name and run ID (#231) --- lib/utils.js | 6 +++++- package-lock.json | 2 +- package.json | 2 +- src/utils.ts | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 0fe8d85e..6fd5fcad 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -125,13 +125,17 @@ class Utils { const exchangeUrl = jfrogCredentials.jfrogUrl.replace(/\/$/, '') + '/access/api/v1/oidc/token'; core.debug('Exchanging GitHub JSON web token with a JFrog access token...'); let projectKey = process.env.JF_PROJECT || ''; + let jobId = process.env.GITHUB_JOB || ''; + let runId = process.env.GITHUB_RUN_ID || ''; const httpClient = new http_client_1.HttpClient(); const data = `{ "grant_type": "urn:ietf:params:oauth:grant-type:token-exchange", "subject_token_type": "urn:ietf:params:oauth:token-type:id_token", "subject_token": "${jsonWebToken}", "provider_name": "${oidcProviderName}", - "project_key": "${projectKey}" + "project_key": "${projectKey}", + "gh_job_id": "${jobId}", + "gh_run_id": "${runId}" }`; const additionalHeaders = { 'Content-Type': 'application/json', diff --git a/package-lock.json b/package-lock.json index f91431a8..850370ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@jfrog/setup-jfrog-cli", - "version": "4.4.2", + "version": "4.4.3", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index a793a7d1..18570960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jfrog/setup-jfrog-cli", - "version": "4.4.2", + "version": "4.4.3", "private": true, "description": "Setup JFrog CLI in GitHub Actions", "main": "lib/main.js", diff --git a/src/utils.ts b/src/utils.ts index 2d9e0814..06a861d4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -161,6 +161,8 @@ export class Utils { "subject_token": "${jsonWebToken}", "provider_name": "${oidcProviderName}", "project_key": "${projectKey}", + "gh_job_id": "${jobId}", + "gh_run_id": "${runId}" }`; const additionalHeaders: OutgoingHttpHeaders = {