Skip to content

Conversation

cklin
Copy link
Contributor

@cklin cklin commented Sep 11, 2025

This PR updates the init action to save the config again at the end of run(), so that config updates in run() are correctly propagated to the analyze action.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

This commit updates the init action to save the config again at the end
of run(), so that config updates in run() are correctly propagated to
the analyze action.
@cklin cklin marked this pull request as ready for review September 11, 2025 15:22
@cklin cklin requested a review from a team as a code owner September 11, 2025 15:22
@cklin cklin requested review from Copilot and removed request for a team September 11, 2025 15:22
Copy link
Contributor

@Copilot Copilot AI left a 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 addresses a configuration propagation issue in the init action by saving the updated config at the end of the run() function to ensure config changes are properly passed to the analyze action.

  • Exports the saveConfig function in config-utils.ts to make it publicly available
  • Adds a call to save the config after successful initialization and before sending the status report

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/config-utils.ts Exports the saveConfig function to make it accessible from other modules
src/init-action.ts Adds config saving after initialization to ensure updated config is persisted for the analyze action
lib/init-action.js Generated JavaScript code (not reviewed per guidelines)

@cklin cklin requested a review from mbg September 11, 2025 15:23
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Thanks for noticing this and implementing a fix!

I am wondering whether we can remove the saveConfig call at the end of initConfig. There'll probably be some tests that would need changing, but I can't immediately think of a good reason why the config has to be saved that early.

If we are adding this later call (which seems like it's necessary given the potential changes to the config after initConfig), I'd ideally have this be the only place where we save the config.

);

// The saved config file should now exist
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
Copy link
Member

Choose a reason for hiding this comment

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

It might be possible to keep this test if you now manually call saveConfig before this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The stated purpose of the test is to verify that initConfig() saves the config file. After the suggested change, initConfig() no longer saves the config file.

Can you clarify how you would like to see this test saved?

Copy link
Member

Choose a reason for hiding this comment

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

I think this test is more of a round-trip test: whether saving a config and then loading it results in the same object. It just so happened that initConfig was saving the config before, but not what was primarily being tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@cklin cklin force-pushed the cklin/init-save-updated-config branch from 05b2852 to 5c30ae4 Compare September 11, 2025 19:31
@cklin cklin requested a review from mbg September 11, 2025 20:10
@cklin cklin merged commit 0d33fd9 into main Sep 11, 2025
290 checks passed
@cklin cklin deleted the cklin/init-save-updated-config branch September 11, 2025 21:19
@github-actions github-actions bot mentioned this pull request Sep 25, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants