Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New OIDC fields added, including the GitHub job name and run ID #225

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,18 @@ export class Utils {
core.debug('Exchanging GitHub JSON web token with a JFrog access token...');

let projectKey: string = process.env.JF_PROJECT || '';
let jobId: string = process.env.GITHUB_JOB || '';
let runId: string = process.env.GITHUB_RUN_ID || '';

const httpClient: HttpClient = new HttpClient();
const data: string = `{
"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: OutgoingHttpHeaders = {
Expand Down
Loading