GitHub Actions "The save-state and set-output commands are deprecated"
GitHub deprecated the stdout workflow commands ::save-state:: and ::set-output:: for security reasons and is disabling them. Code that still echoes them must write to the $GITHUB_STATE and $GITHUB_OUTPUT files instead.
What this error means
Runs emit deprecation warnings (or fail once disabled) referencing save-state and set-output commands.
Warning: The `save-state` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files.
Warning: The `set-output` command is deprecated and will be disabled soon.Common causes
Action or step echoes the legacy command
A run step or an old action version still prints ::set-output name=x:: or ::save-state:: to stdout.
Outdated action versions
Older releases of common actions used the deprecated commands; they are fixed in newer tags.
How to fix it
Write to the environment files
- Replace echo "::set-output name=key::value" with appending to $GITHUB_OUTPUT.
- Replace ::save-state:: with appending to $GITHUB_STATE.
- id: vars
run: |
echo "key=value" >> "${GITHUB_OUTPUT}"
- run: echo "${{ steps.vars.outputs.key }}"Upgrade actions to current tags
- Bump pinned action versions to releases that use environment files.
- Re-run and confirm the warnings clear.
How to prevent it
- Grep workflows and composite actions for set-output and save-state during reviews.
- Keep actions pinned to maintained major versions.