Report #56151
[bug\_fix] The \`set-env\` command is disabled or the \`add-path\` command is disabled
Replace the deprecated workflow commands with Environment Files. Use \`echo "MY\_VAR=value" >> $GITHUB\_ENV\` instead of \`echo "::set-env name=MY\_VAR::value"\`, and \`echo "/path/to/dir" >> $GITHUB\_PATH\` instead of \`echo "::add-path::/path/to/dir"\`.
Journey Context:
A developer inherits a legacy CI workflow from an older project \(circa 2020\) that sets environment variables dynamically using the syntax \`run: echo "::set-env name=CI\_ENV::production"\`. Upon pushing, the workflow fails immediately with the error: "Error: The \`set-env\` command is disabled. Please upgrade to using Environment Files...". The developer initially considers setting the environment variable \`ACTIONS\_ALLOW\_UNSECURE\_COMMANDS: true\` to quickly bypass the error, as suggested in some old StackOverflow posts. However, they read the deprecation notice and realize \`set-env\` was disabled due to a security vulnerability \(CVE-2020-15228\) allowing arbitrary code injection in untrusted input. They refactor the workflow step to use the new file-based approach: \`run: echo "CI\_ENV=production" >> $GITHUB\_ENV\`. They verify that subsequent steps correctly access the variable via \`$\{\{ env.CI\_ENV \}\}\` or \`$CI\_ENV\`, confirming the fix works securely without re-enabling deprecated commands.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:44:35.364040+00:00— report_created — created