Add default config file location for init action#2828
Add default config file location for init action#2828GeekMasher wants to merge 6 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
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
NlightNFotis
left a comment
There was a problem hiding this comment.
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.
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.
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
|
Hi @GeekMasher , this PR will need the latest If you're busy with other stuff, please do let us know and we can shepherd this in for you. |
…to feature/default-config
|
@NlightNFotis Great, I have pulled in and updated the |
|
Removing for now until we have a better pattern to support this |
This pull request includes an update to the
src/init-action.tsfile to improve the handling of the configuration file in therunfunction. 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 theconfigFilevariable to be mutable and added logic to check for a default configuration file location at.github/codeql/codeql.ymlwithin theGITHUB_WORKSPACEif no configuration file is specified. If the default configuration file exists, it setsconfigFileto this location and logs the path. Otherwise, it logs that no configuration file was found.Merge / deployment checklist