Use github.context.payload... to determine if running on fork

This commit is contained in:
Angela P Wen
2024-01-16 09:50:13 -08:00
parent 30f279ce08
commit b0b38b29b2
3 changed files with 6 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = exports.tryUploadSarifIfRunFailed = void 0;
const github = __importStar(require("@actions/github"));
const actionsUtil = __importStar(require("./actions-util"));
const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql");
@@ -117,7 +118,7 @@ async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, p
// We do not delete uploaded SARIFs if we're on a fork, as we're missing the
// appropriate permissions.
if (process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
repositoryNwo.owner !== "github") {
github.context.payload.pull_request?.head.repo.fork === false) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
}
// Upload appropriate Actions artifacts for debugging

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,5 @@
import * as github from "@actions/github";
import * as actionsUtil from "./actions-util";
import { getApiClient } from "./api-client";
import { getCodeQL } from "./codeql";
@@ -186,7 +188,7 @@ export async function run(
// appropriate permissions.
if (
process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
repositoryNwo.owner !== "github"
github.context.payload.pull_request?.head.repo.fork === false
) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
}