Add expect-error input to force PR check green on expected failure (#1177)

This commit is contained in:
Angela P Wen 2022-08-16 16:27:14 -07:00 committed by GitHub
parent b0d61cff1a
commit 9b7fa3dd99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 96 additions and 16 deletions

View file

@ -8,6 +8,7 @@ import * as safeWhich from "@chrisgavin/safe-which";
import * as yaml from "js-yaml";
import * as api from "./api-client";
import { CODEQL_DEFAULT_ACTION_REPOSITORY } from "./codeql";
import { Config } from "./config-utils";
import * as sharedEnv from "./shared-environment";
import {
@ -900,3 +901,17 @@ export async function printDebugLogs(config: Config) {
walkLogFiles(logsDirectory);
}
}
// Returns whether workflow kicked off by codeql-action repo itself,
// or a fork of it.
export function isAnalyzingCodeQLActionRepoOrFork(): boolean {
const codeQLActionRepoUrl = `https://api.github.com/repos/${CODEQL_DEFAULT_ACTION_REPOSITORY}`;
const repo = getWorkflowEvent()?.repository;
if (repo?.url === codeQLActionRepoUrl) {
return true;
}
if (repo?.fork && repo?.parent?.url === codeQLActionRepoUrl) {
return true;
}
return false;
}