-
Notifications
You must be signed in to change notification settings - Fork 357
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the configuration file handling in the init action by adding logic to use a default configuration file if none is provided.
- Made the configFile variable mutable
- Added a default config file lookup in GITHUB_WORKSPACE
- Logged appropriate messages based on whether the default file is found
Comments suppressed due to low confidence (1)
src/init-action.ts:302
- Consider checking for both undefined and empty string values for configFile, as getOptionalInput may return an empty string when the input is not provided.
if (configFile === undefined) {
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution, this looks reasonable to me.
I think we also need a changelog entry for this change, and it also might be something that might need a docs change, but I will let someone else confirm that.
logger.info( | ||
`Using default config file location: ${path.resolve(configFile)}`, | ||
); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
This pull request includes an update to the
src/init-action.ts
file to improve the handling of the configuration file in therun
function. The most important change is the addition of logic to set a default configuration file location if none is provided.Improvements to configuration file handling:
src/init-action.ts
: Changed theconfigFile
variable to be mutable and added logic to check for a default configuration file location at.github/codeql/codeql.yml
within theGITHUB_WORKSPACE
if no configuration file is specified. If the default configuration file exists, it setsconfigFile
to this location and logs the path. Otherwise, it logs that no configuration file was found.Merge / deployment checklist