avoid sending status reports on enterprise
This commit is contained in:
parent
e8896a906a
commit
368c14c502
6 changed files with 60 additions and 21 deletions
23
lib/util.js
generated
23
lib/util.js
generated
|
|
@ -14,6 +14,25 @@ const os = __importStar(require("os"));
|
|||
const path = __importStar(require("path"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
/**
|
||||
* The API URL for github.com.
|
||||
*/
|
||||
exports.GITHUB_DOTCOM_API_URL = "https://api.github.com";
|
||||
/**
|
||||
* Get the API URL for the GitHub instance we are connected to.
|
||||
* May be for github.com or for an enterprise instance.
|
||||
*/
|
||||
function getInstanceAPIURL() {
|
||||
return process.env["GITHUB_API_URL"] || exports.GITHUB_DOTCOM_API_URL;
|
||||
}
|
||||
exports.getInstanceAPIURL = getInstanceAPIURL;
|
||||
/**
|
||||
* Are we running against a GitHub Enterpise instance, as opposed to github.com.
|
||||
*/
|
||||
function isEnterprise() {
|
||||
return getInstanceAPIURL() !== exports.GITHUB_DOTCOM_API_URL;
|
||||
}
|
||||
exports.isEnterprise = isEnterprise;
|
||||
/**
|
||||
* Should the current action be aborted?
|
||||
*
|
||||
|
|
@ -198,6 +217,10 @@ exports.createStatusReportBase = createStatusReportBase;
|
|||
* Returns whether sending the status report was successful of not.
|
||||
*/
|
||||
async function sendStatusReport(statusReport, ignoreFailures) {
|
||||
if (isEnterprise()) {
|
||||
core.debug("Not sending status report to GitHub Enterprise");
|
||||
return true;
|
||||
}
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug('Sending status report: ' + statusReportJSON);
|
||||
const nwo = getRequiredEnvParam("GITHUB_REPOSITORY");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue