Skip to content
Latchkey

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.

Actions log
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.

.github/workflows/ci.yml
- run: echo "cleanup=true" >> "$GITHUB_STATE"
# the post step sees it as $STATE_cleanup

Upgrade the action toolkit

  1. Bump @actions/core to a version that uses environment files.
  2. Replace any echo "::save-state ..." with appends to GITHUB_STATE.
  3. 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.

Frequently asked questions

What causes ""save-state deprecated""?
A step or a JavaScript action still emits echo "::save-state name=x::value", which GitHub deprecated in favor of the GITHUB_STATE file.
How do I fix "save-state deprecated"?
Append name=value to the GITHUB_STATE file; the post step reads it from the STATE_<name> env var.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card