GitHub Actions "save-state command is deprecated" - Use GITHUB_STATE
GitHub deprecated the ::save-state workflow command used by actions to hand state to their post (cleanup) step. Code that still echoes it warns now and will stop working, so the post step loses its state.
What this error means
A run logs that the save-state command is deprecated, and a custom action post step no longer receives the value it saved during the main step.
Warning: The `save-state` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files.Common causes
Legacy ::save-state in a script or action
A step or a JavaScript action still emits echo "::save-state name=x::value", which GitHub deprecated in favor of the GITHUB_STATE file.
Outdated toolkit in a custom action
A custom action built on an old @actions/core version uses the legacy command internally until the dependency is upgraded.
How to fix it
Write to GITHUB_STATE instead
Append name=value to the GITHUB_STATE file; the post step reads it from the STATE_<name> env var.
- run: echo "cleanup=true" >> "$GITHUB_STATE"
# the post step sees it as $STATE_cleanupUpgrade the action toolkit
- Bump @actions/core to a version that uses environment files.
- Replace any echo "::save-state ..." with appends to GITHUB_STATE.
- Re-test that the post/cleanup step still receives its state.
How to prevent it
- Use GITHUB_STATE in all custom actions instead of ::save-state.
- Keep @actions/core current so deprecated commands are removed.
- Grep for ::save-state in CI to catch regressions.