Skip to content

Commit d79018d

Browse files
committed
JPI-396 - add github token param
1 parent 0775fb3 commit d79018d

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lib/utils.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Utils {
5757
oidcProviderName: core.getInput(Utils.OIDC_INTEGRATION_PROVIDER_NAME),
5858
oidcAudience: core.getInput(Utils.OIDC_AUDIENCE_ARG) || '',
5959
oidcTokenId: '',
60+
githubToken: process.env.GITHUB_TOKEN,
6061
};
6162
if (jfrogCredentials.password && !jfrogCredentials.username) {
6263
throw new Error('JF_PASSWORD is configured, but the JF_USER environment variable was not set.');
@@ -281,7 +282,13 @@ class Utils {
281282
}
282283
static configJFrogServers(jfrogCredentials) {
283284
return __awaiter(this, void 0, void 0, function* () {
284-
let cliConfigCmd = ['config'];
285+
let cliConfigCmd = [];
286+
let githubToken = jfrogCredentials.githubToken;
287+
if (!!githubToken) {
288+
// Github Token
289+
cliConfigCmd = cliConfigCmd.concat('--github-token', githubToken);
290+
}
291+
cliConfigCmd = cliConfigCmd.concat('config');
285292
for (let configToken of Utils.getConfigTokens()) {
286293
// Mark the credentials as secrets to prevent them from being printed in the logs or exported to other workflows
287294
core.setSecret(configToken);

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface JfrogCredentials {
1313
oidcProviderName?: string;
1414
oidcTokenId?: string;
1515
oidcAudience: string;
16+
githubToken?: string;
1617
}
1718

1819
/**

src/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class Utils {
6767
oidcProviderName: core.getInput(Utils.OIDC_INTEGRATION_PROVIDER_NAME),
6868
oidcAudience: core.getInput(Utils.OIDC_AUDIENCE_ARG) || '',
6969
oidcTokenId: '',
70+
githubToken: process.env.GITHUB_TOKEN,
7071
} as JfrogCredentials;
7172

7273
if (jfrogCredentials.password && !jfrogCredentials.username) {
@@ -317,7 +318,13 @@ export class Utils {
317318
}
318319

319320
public static async configJFrogServers(jfrogCredentials: JfrogCredentials) {
320-
let cliConfigCmd: string[] = ['config'];
321+
let cliConfigCmd: string[] = [];
322+
let githubToken: string | undefined = jfrogCredentials.githubToken;
323+
if (!!githubToken) {
324+
// Github Token
325+
cliConfigCmd = cliConfigCmd.concat('--github-token', githubToken);
326+
}
327+
cliConfigCmd = cliConfigCmd.concat('config');
321328
for (let configToken of Utils.getConfigTokens()) {
322329
// Mark the credentials as secrets to prevent them from being printed in the logs or exported to other workflows
323330
core.setSecret(configToken);

0 commit comments

Comments
 (0)