Skip to content

Commit b9ce36f

Browse files
committed
Cross-check Go binary in analyze Action
1 parent 8482e80 commit b9ce36f

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

lib/analyze-action.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze-action.ts

+14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import * as uploadLib from "./upload-lib";
3535
import { UploadResult } from "./upload-lib";
3636
import * as util from "./util";
3737
import { checkForTimeout, wrapError } from "./util";
38+
import { safeWhich } from "@chrisgavin/safe-which";
3839

3940
interface AnalysisStatusReport
4041
extends uploadLib.UploadStatusReport,
@@ -236,6 +237,19 @@ async function run() {
236237
logger,
237238
);
238239

240+
// Check that the Go wrapper script still exists, if set
241+
const goWrapperPath = process.env[EnvVar.GO_BINARY_LOCATION];
242+
243+
if (goWrapperPath !== undefined) {
244+
const goBinaryPath = await safeWhich("go");
245+
246+
if (goWrapperPath !== goBinaryPath) {
247+
core.warning(
248+
"Unexpected result for `which go`: please ensure that the correct version of Go is installed before the `codeql-action/init` Action is used.",
249+
);
250+
}
251+
}
252+
239253
await runAutobuildIfLegacyGoWorkflow(config, logger);
240254

241255
dbCreationTimings = await runFinalize(

0 commit comments

Comments
 (0)