Skip to content
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: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ inputs:
custom-server-id:
description: "Custom JFrog CLI configuration server ID to use instead of the default one generated by the action."
required: false
ghe-base-url:
description: 'Base URL GitHub Enterprise Server REST API.'
required: false
ghe_base_url:
description: 'Alias for ghe-base-url'
required: false
outputs:
oidc-token:
description: "JFrog OIDC token generated by the Setup JFrog CLI when setting oidc-provider-name."
Expand Down
2 changes: 1 addition & 1 deletion lib/job-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class JobSummary {
static uploadCodeScanningSarif(encodedSarif, token) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const inputBaseUrl = core.getInput('ghe-base-url', { required: false }) || core.getInput('ghe_base_url', { required: false }) || '';
const inputBaseUrl = utils_1.Utils.getGheBaseUrl();
const octokit = inputBaseUrl ? github.getOctokit(token, { baseUrl: inputBaseUrl }) : github.getOctokit(token);
const response = yield octokit.request('POST /repos/{owner}/{repo}/code-scanning/sarifs', {
owner: github.context.repo.owner,
Expand Down
7 changes: 7 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class Utils {
}
return jfrogCredentials;
}
static getGheBaseUrl() {
const v = core.getInput(Utils.GHE_BASE_URL_INPUT, { required: false }) || core.getInput(Utils.GHE_BASE_URL_ALIAS_INPUT, { required: false }) || '';
return v.trim();
}
static getAndAddCliToPath(jfrogCredentials) {
return __awaiter(this, void 0, void 0, function* () {
let version = core.getInput(Utils.CLI_VERSION_ARG);
Expand Down Expand Up @@ -489,3 +493,6 @@ Utils.AUTO_BUILD_PUBLISH_DISABLE = 'disable-auto-build-publish';
Utils.AUTO_EVIDENCE_COLLECTION_DISABLE = 'disable-auto-evidence-collection';
// Custom server ID input
Utils.CUSTOM_SERVER_ID = 'custom-server-id';
// GHES baseUrl support
Utils.GHE_BASE_URL_INPUT = 'ghe-base-url';
Utils.GHE_BASE_URL_ALIAS_INPUT = 'ghe_base_url';
2 changes: 1 addition & 1 deletion src/job-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class JobSummary {
* @throws Will throw an error if the HTTP response status is not in the 2xx range or if authentication fails.
*/
private static async uploadCodeScanningSarif(encodedSarif: string, token: string) {
const inputBaseUrl = core.getInput('ghe-base-url', { required: false }) || core.getInput('ghe_base_url', { required: false }) || '';
const inputBaseUrl = Utils.getGheBaseUrl();

const octokit = inputBaseUrl ? github.getOctokit(token, { baseUrl: inputBaseUrl }) : github.getOctokit(token);

Expand Down
9 changes: 9 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export class Utils {
public static readonly AUTO_EVIDENCE_COLLECTION_DISABLE: string = 'disable-auto-evidence-collection';
// Custom server ID input
private static readonly CUSTOM_SERVER_ID: string = 'custom-server-id';
// GHES baseUrl support
public static readonly GHE_BASE_URL_INPUT: string = 'ghe-base-url';
public static readonly GHE_BASE_URL_ALIAS_INPUT: string = 'ghe_base_url';

/**
* Gathers JFrog's credentials from environment variables and delivers them in a JfrogCredentials structure
Expand Down Expand Up @@ -88,6 +91,12 @@ export class Utils {
return jfrogCredentials;
}

public static getGheBaseUrl(): string {
const v =
core.getInput(Utils.GHE_BASE_URL_INPUT, { required: false }) || core.getInput(Utils.GHE_BASE_URL_ALIAS_INPUT, { required: false }) || '';
return v.trim();
}

public static async getAndAddCliToPath(jfrogCredentials: JfrogCredentials) {
let version: string = core.getInput(Utils.CLI_VERSION_ARG);
let cliRemote: string = core.getInput(Utils.CLI_REMOTE_ARG);
Expand Down
Loading