Skip to content

Commit

Permalink
Cross-check Go binary in analyze Action
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Sep 28, 2023
1 parent 8482e80 commit b9ce36f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/analyze-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import * as uploadLib from "./upload-lib";
import { UploadResult } from "./upload-lib";
import * as util from "./util";
import { checkForTimeout, wrapError } from "./util";
import { safeWhich } from "@chrisgavin/safe-which";

interface AnalysisStatusReport
extends uploadLib.UploadStatusReport,
Expand Down Expand Up @@ -236,6 +237,19 @@ async function run() {
logger,
);

// Check that the Go wrapper script still exists, if set
const goWrapperPath = process.env[EnvVar.GO_BINARY_LOCATION];

if (goWrapperPath !== undefined) {
const goBinaryPath = await safeWhich("go");

if (goWrapperPath !== goBinaryPath) {
core.warning(
"Unexpected result for `which go`: please ensure that the correct version of Go is installed before the `codeql-action/init` Action is used.",
);
}
}

await runAutobuildIfLegacyGoWorkflow(config, logger);

dbCreationTimings = await runFinalize(
Expand Down

0 comments on commit b9ce36f

Please sign in to comment.