Skip to content

Commit 5218f93

Browse files
author
Max Veytsman
authored
Merge pull request #10 from github/autobuild_errors
Improve errors & warnings in autobuild
2 parents d46c1c7 + 984552a commit 5218f93

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

lib/autobuild.js

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

src/autobuild.ts

Lines changed: 8 additions & 3 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);
@@ -44,7 +49,7 @@ async function run() {
4449
core.endGroup();
4550

4651
} catch (error) {
47-
core.setFailed(error.message);
52+
core.setFailed("We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. " + error.message);
4853
await util.reportActionFailed('autobuild', error.message, error.stack);
4954
return;
5055
}
@@ -53,6 +58,6 @@ async function run() {
5358
}
5459

5560
run().catch(e => {
56-
core.setFailed("autobuild action failed: " + e);
61+
core.setFailed("autobuild action failed. " + e);
5762
console.log(e);
5863
});

0 commit comments

Comments
 (0)