Skip to content

Commit a1a82f7

Browse files
committed
feat: add default config file location for init action
1 parent 486ab5a commit a1a82f7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/init-action.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,24 @@ async function run() {
298298

299299
core.exportVariable(EnvVar.INIT_ACTION_HAS_RUN, "true");
300300

301-
const configFile = getOptionalInput("config-file");
301+
let configFile = getOptionalInput("config-file");
302+
if (configFile === undefined) {
303+
const defaultLocation = path.join(
304+
getRequiredEnvParam("GITHUB_WORKSPACE"),
305+
".github",
306+
"codeql",
307+
"codeql.yml",
308+
);
309+
310+
if (fs.existsSync(defaultLocation)) {
311+
configFile = defaultLocation;
312+
logger.info(
313+
`Using default config file location: ${path.resolve(configFile)}`,
314+
);
315+
} else {
316+
logger.info("No config file found.");
317+
}
318+
}
302319

303320
try {
304321
const statusReportBase = await createStatusReportBase(

0 commit comments

Comments
 (0)