Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default config file location for init action #2828

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,24 @@ async function run() {

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

const configFile = getOptionalInput("config-file");
let configFile = getOptionalInput("config-file");
if (configFile === undefined) {
const defaultLocation = path.join(
getRequiredEnvParam("GITHUB_WORKSPACE"),
".github",
"codeql",
"codeql.yml",
);

if (fs.existsSync(defaultLocation)) {
configFile = defaultLocation;
logger.info(
`Using default config file location: ${path.resolve(configFile)}`,
);
} else {
logger.info("No config file found.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious whether it would make sense to add a log message if the default file fails to be found, to warn both the users and us when debugging that something has gone very wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually added it in the first commit but thought it would almost always trigger a log that no config was used. I'm okay with either personally

}

try {
const statusReportBase = await createStatusReportBase(
Expand Down
Loading