Skip to content

Commit f237316

Browse files
author
Max Veytsman
committed
Improve errors & warnings in autobuild
1 parent bbc0dc8 commit f237316

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/autobuild.js

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/autobuild.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ async function run() {
1515
// We want pick the dominant language in the repo from the ones we're able to build
1616
// The languages are sorted in order specified by user or by lines of code if we got
1717
// them from the GitHub API, so try to build the first language on the list.
18-
const language = process.env[sharedEnv.CODEQL_ACTION_TRACED_LANGUAGES]?.split(',')[0];
18+
const autobuildLanguages = process.env[sharedEnv.CODEQL_ACTION_TRACED_LANGUAGES]?.split(',') || [];
19+
const language = autobuildLanguages[0];
1920

2021
if (!language) {
2122
core.info("None of the languages in this project require extra build steps");
@@ -24,6 +25,10 @@ async function run() {
2425

2526
core.debug(`Detected dominant traced language: ${language}`);
2627

28+
if (autobuildLanguages.length > 1) {
29+
core.warning(`We will only automatically build ${language} code. If you wish to scan ${autobuildLanguages.slice(1).join(' and ')}, you must replace this block with custom build steps.`);
30+
}
31+
2732
core.startGroup(`Attempting to automatically build ${language} code`);
2833
// TODO: share config accross actions better via env variables
2934
const codeqlCmd = util.getRequiredEnvParam(sharedEnv.CODEQL_ACTION_CMD);
@@ -53,6 +58,6 @@ async function run() {
5358
}
5459

5560
run().catch(e => {
56-
core.setFailed("autobuild action failed: " + e);
61+
core.setFailed("We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. codeql/autobuild action failed. " + e);
5762
console.log(e);
5863
});

0 commit comments

Comments
 (0)