All jobs

Fix "The set-output command is deprecated" in GitHub Actions Workflows

Yes. An agent finds every set-output and save-state command in your workflows, moves each to GITHUB_OUTPUT, traces who reads the value, and opens a pull request.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent builds the inventory with a text search across .github, scripts and local actions, and treats a linter as a second opinion only. In a repository like puma/puma-dev there are two commands. ci.yml line 61, in the devel-release job, runs echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c-8)" in a step with id version. release.yml line 22 runs echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/v} in a step with id get_version, unquoted. Running actionlint 1.7.12 over the same files reports the second and says nothing about the first, which is the reason the search comes first.

For each command it follows the value to its readers, because the rewrite is only safe if the output keeps its name and step id. steps.version.outputs.sha8 is read four times in ci.yml: once as the RELEASE environment variable for make release, and three times in artifact names of the form puma-dev-<sha8>-linux-amd64. steps.get_version.outputs.RELEASE_VERSION is read once, again as RELEASE. The Makefile puts that variable into the binary with -X main.Version=$$RELEASE and into the archive names under pkg/. So an output that silently came back empty would not fail the workflow. It would publish a release whose binary reports no version, in files named puma-dev--linux-amd64.tar.gz.

The replacement writes to the file the runner provides: echo "sha8=$(echo ${GITHUB_SHA} | cut -c-8)" >> "$GITHUB_OUTPUT" and echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT". Both values are single-line, so neither needs the delimiter form that multi-line values require. The agent cannot run GitHub's hosted runners from its sandbox, and it says so. What it can do is execute the two new lines in a shell with GITHUB_OUTPUT pointed at a temporary file and GITHUB_SHA and GITHUB_REF set to sample values, then print the file. For a tag ref of refs/tags/v0.18.3 the file reads RELEASE_VERSION=0.18.3, and a forty-character SHA yields the first eight as sha8.

While it is in the files it reports what else the linter says without widening the change. Here that is a list of pinned action versions the linter considers too old to run, including actions/upload-artifact@v3 in the same job. Those are a different failure with a different fix, and the pull request lists them as follow-ups.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Our GitHub Actions runs show: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. Fix every cause in this repository. Search all files under .github, every script a workflow calls, and every local composite or JavaScript action for ::set-output, ::save-state, set-env and add-path, quoted or unquoted; list each hit with file, line, step id and output name. Run actionlint if you can install it and say where its findings differ from your search. For each output, list every expression that reads it (steps.<id>.outputs.<name>, needs.<job>.outputs.<name>, job-level outputs) and what the value ends up in: an environment variable, a file name, a version string, a condition. Rewrite each command to append name=value to \"$GITHUB_OUTPUT\" (or \"$GITHUB_STATE\"), quoting the file variable, keeping the step id and output name unchanged, and using the delimiter form for any value that can contain a newline. Do not change what the value is. Then execute each rewritten line locally with GITHUB_OUTPUT set to a temp file and realistic values for the variables it uses, and show the file's contents. Where the warning comes from a third-party action pinned to an old version and not from our own files, name the action and the release that stopped using the command, and bump it. Report other deprecated or failing actions you notice as follow-ups without changing them. Open a pull request with the inventory, the reader list and the local output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request that changes one line in each of two workflow files. The description gives the inventory, then the reader table: for each output, the expressions that consume it and where the value lands. For puma-dev that table makes the stakes plain in a way the two-line diff does not, since both values end up inside a released binary and its file names.

It includes the local execution: the two commands as rewritten, the sample environment, and the contents of the temporary output file. It states the limit of that evidence. The lines are run in a shell on Linux, while both jobs run on macos-latest, and the first real proof is the next workflow run. For the ci.yml change that is the pull request's own check run, where the annotation should be gone and the artifact names should carry eight hex characters. For release.yml, which runs only on a v* tag, the description recommends pushing a throwaway prerelease tag or reading the next release's file names.

Before merging, a reviewer confirms that no step id or output name moved, which the table shows, and looks at the follow-up list. If the same job is already failing for another reason, this pull request will not turn it green, and the description says which finding is responsible.

Run it on every repository that still uses set-output

The deprecation is a warning annotation on runs that otherwise succeed, so it produces no failure to trigger on. GitHub announced it in October 2022, planned to disable the commands in May 2023 and then postponed that, which is why so many workflows still carry them. Treat it as a sweep. Search your organisation's code for ::set-output and ::save-state, and start one run per repository through the API with the prompt above and that repository in resources. Give each start a request_id that is a UUID v5 of the repository name, so repeating the sweep returns the runs already started.

A key runs a limited number of sessions at once, and a start past that limit is still accepted: it answers with status: "queued" and begins when a slot frees. You can submit the whole list in one loop and read the pull request from each session as it completes.

The use case this job follows, with its automation and trigger: Fix a bug from an alert.

Why run it on Rush?

Every individual edit here is trivial, and that is the trap. The warning shows on dozens of repositories, somebody scripts a replacement, and one output whose step id was mistyped or whose value contained a newline starts returning an empty string. Nothing fails. A release goes out with a blank version three weeks later. The agent's reader table exists to prevent that: it ties each rewritten line to every place the value is used, and it runs the new line to show what gets written.

Running it on Rush means the sweep is a list of requests, not a week of somebody's attention. Each repository gets its own sandbox and its own pull request with the same three pieces of evidence, and the session transcript keeps the search output, so a reviewer can check that an unquoted variant or a script outside .github/workflows was not missed.

Frequently asked questions

What is the new syntax?

Append a name=value line to the file whose path is in $GITHUB_OUTPUT: echo "name=value" >> "$GITHUB_OUTPUT". Other steps read it exactly as before, as steps.<id>.outputs.name. State saved for a post step goes to $GITHUB_STATE in the same way.

How do multi-line values work?

With a delimiter: write name<<EOF, then the lines of the value, then EOF, all appended to the same file. A newline inside a plain name=value line ends the value there, and the rest is read as a separate line. The agent checks whether each value can contain one, for example command output or a changelog excerpt, and uses the delimiter form where it can.

The warning points at a step that uses someone else's action. What then?

Then the command is printed by that action's code, usually an old release built on a version of the Actions toolkit that still wrote outputs to stdout. Nothing in your workflow text needs rewriting. The agent identifies the action, finds the release that moved to environment files, and bumps the pin.

Why did GitHub deprecate it?

Workflow commands printed to stdout can be forged by anything else that prints there. A step that logs untrusted text, such as an issue title or a test's output, could have a line in that text interpreted as a command. Writing to a file that only the step can reach closes that path.

Can the agent run the workflow to prove the fix?

It cannot run GitHub's hosted runners. It executes the rewritten shell lines itself and shows what they write, and the pull request's own checks are the first real run for workflows that trigger on pull requests. For workflows that run only on tags or schedules, it says how to exercise them.

More GitHub Actions jobs

More jobs like this: Fix a bug from an alert

Keep reading