Skip to content

Commit 73cafc9

Browse files
authored
New OIDC fields added, including the GitHub job name and run ID (#225)
1 parent 18e785f commit 73cafc9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/utils.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ class Utils {
125125
const exchangeUrl = jfrogCredentials.jfrogUrl.replace(/\/$/, '') + '/access/api/v1/oidc/token';
126126
core.debug('Exchanging GitHub JSON web token with a JFrog access token...');
127127
let projectKey = process.env.JF_PROJECT || '';
128+
let jobId = process.env.GITHUB_JOB || '';
129+
let runId = process.env.GITHUB_RUN_ID || '';
128130
const httpClient = new http_client_1.HttpClient();
129131
const data = `{
130132
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
131133
"subject_token_type": "urn:ietf:params:oauth:token-type:id_token",
132134
"subject_token": "${jsonWebToken}",
133135
"provider_name": "${oidcProviderName}",
134-
"project_key": "${projectKey}"
136+
"project_key": "${projectKey}",
137+
"gh_job_id": "${jobId}",
138+
"gh_run_id": "${runId}",
135139
}`;
136140
const additionalHeaders = {
137141
'Content-Type': 'application/json',

src/utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,18 @@ export class Utils {
151151
core.debug('Exchanging GitHub JSON web token with a JFrog access token...');
152152

153153
let projectKey: string = process.env.JF_PROJECT || '';
154+
let jobId: string = process.env.GITHUB_JOB || '';
155+
let runId: string = process.env.GITHUB_RUN_ID || '';
154156

155157
const httpClient: HttpClient = new HttpClient();
156158
const data: string = `{
157159
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
158160
"subject_token_type": "urn:ietf:params:oauth:token-type:id_token",
159161
"subject_token": "${jsonWebToken}",
160162
"provider_name": "${oidcProviderName}",
161-
"project_key": "${projectKey}"
163+
"project_key": "${projectKey}",
164+
"gh_job_id": "${jobId}",
165+
"gh_run_id": "${runId}",
162166
}`;
163167

164168
const additionalHeaders: OutgoingHttpHeaders = {

0 commit comments

Comments
 (0)