Remove local environment running

This is a functionality that never worked perfectly and hasn't been
used for a while.

This allows developers to run the action on their local machine, but
the run was always flaky and never 100% mirrored what was happening on
the actions runner.
This commit is contained in:
Andrew Eisenberg 2021-06-01 15:04:15 -07:00
parent 3708898bf2
commit 2c2ebdc5c5
19 changed files with 21 additions and 262 deletions

View file

@ -8,7 +8,7 @@ import * as yaml from "js-yaml";
import * as api from "./api-client";
import * as sharedEnv from "./shared-environment";
import { getRequiredEnvParam, GITHUB_DOTCOM_URL, isLocalRun } from "./util";
import { getRequiredEnvParam, GITHUB_DOTCOM_URL } from "./util";
/**
* The utils in this module are meant to be run inside of the action only.
@ -45,26 +45,6 @@ export function getToolCacheDirectory(): string {
: getRequiredEnvParam("RUNNER_TOOL_CACHE");
}
/**
* Ensures all required environment variables are set in the context of a local run.
*/
export function prepareLocalRunEnvironment() {
if (!isLocalRun()) {
return;
}
core.debug("Action is running locally.");
if (!process.env.GITHUB_JOB) {
core.exportVariable("GITHUB_JOB", "UNKNOWN-JOB");
}
if (!process.env.CODEQL_ACTION_ANALYSIS_KEY) {
core.exportVariable(
"CODEQL_ACTION_ANALYSIS_KEY",
`LOCAL-RUN:${process.env.GITHUB_JOB}`
);
}
}
/**
* Gets the SHA of the commit that is currently checked out.
*/
@ -352,10 +332,6 @@ export async function getWorkflow(): Promise<Workflow> {
* Get the path of the currently executing workflow.
*/
async function getWorkflowPath(): Promise<string> {
if (isLocalRun()) {
return getRequiredEnvParam("WORKFLOW_PATH");
}
const repo_nwo = getRequiredEnvParam("GITHUB_REPOSITORY").split("/");
const owner = repo_nwo[0];
const repo = repo_nwo[1];
@ -623,11 +599,6 @@ const INCOMPATIBLE_MSG =
export async function sendStatusReport<S extends StatusReportBase>(
statusReport: S
): Promise<boolean> {
if (isLocalRun()) {
core.debug("Not sending status report because this is a local run");
return true;
}
const statusReportJSON = JSON.stringify(statusReport);
core.debug(`Sending status report: ${statusReportJSON}`);