Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 255d945

Browse files
authored
Merge pull request #25 from github/wf
Get rid of misleading query check comment
2 parents 366f7e5 + f6a3085 commit 255d945

File tree

1 file changed

+18
-9
lines changed
  • codeql-learninglab-check/package/src

1 file changed

+18
-9
lines changed

codeql-learninglab-check/package/src/index.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ function isConfig(config: any): config is Config {
145145
* default branch of the repo), then we should just run every query we
146146
* recognize (as if RUN_ALL was true). We do this by setting
147147
* unableToGetChangedQueries to true.
148+
* 5. In this last case, if there is no changed query in the repo
149+
* then it means that this is just the course creation first workflow trigger.
148150
*/
149151

150152
/*
@@ -284,16 +286,23 @@ function isConfig(config: any): config is Config {
284286
console.log(`${pluralize(queriesToRun.length, 'query')} to run:`);
285287
if (queriesToRun.length === 0) {
286288
console.log('...Exiting');
287-
if (RUN_ALL) {
288-
comment += `\n None of the paths for any of the queries in the repository `;
289+
if (unableToGetChangedQueries) {
290+
// There are no changed queries and we didn't find any git diff
291+
// It's just the first run of the action
292+
comment += `\n Hey, I am the CodeQL Learning Lab bot :robot:`
293+
comment += `\n I'm looking forward to checking your queries as you go through this course.\n`
289294
} else {
290-
comment += `\n None of the paths for the queries that have been updated `;
291-
};
292-
comment += `are recognized as part of this course. `;
293-
comment += `Perhaps you need to rename or move a \`.ql\` file? `;
294-
comment += `The expected paths are: \n\n`;
295-
for (const query of Object.keys(config.expectedResults)) {
296-
comment += `* \`${query}\`\n`;
295+
if (RUN_ALL) {
296+
comment += `\n None of the paths for any of the queries in the repository `;
297+
} else {
298+
comment += `\n None of the paths for the queries that have been updated `;
299+
};
300+
comment += `are recognized as part of this course. `;
301+
comment += `Perhaps you need to rename or move a \`.ql\` file? `;
302+
comment += `The expected paths are: \n\n`;
303+
for (const query of Object.keys(config.expectedResults)) {
304+
comment += `* \`${query}\`\n`;
305+
}
297306
}
298307
return await end();
299308
}

0 commit comments

Comments
 (0)