openrewrite / openrewrite/rewrite-github-actions

Replace usage of `set-output` and `save-state`

Open
#30 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
1
Forks
9
Avg merge
5h 27m
Merged PRs (30d)
12

Description

A workflow using save-state or set-output like the following

- name: Save state
  run: echo "::save-state name={name}::{value}"

- name: Set output
  run: echo "::set-output name={name}::{value}"

Should be updated to write to the new GITHUB_STATE and GITHUB_OUTPUT environment files:


- name: Save state
  run: echo "{name}={value}" >> $GITHUB_STATE

- name: Set output
  run: echo "{name}={value}" >> $GITHUB_OUTPUT

See: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

https://github.com/search?l=YAML&q=set-output&type=Code

Note: This recipe needs to be used with runners 2.297.0 or above. We need to warn users about that. See https://github.com/community/community/discussions/36746

Also, the syntax is a little bit different for Windows runners:

https://github.com/orgs/community/discussions/26313#discussioncomment-4467564

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the repository's GitHub Actions migration recipe definitions and their tests, then compare the issue's set-output and save-state examples with the documented GITHUB_OUTPUT and GITHUB_STATE syntax. Check both Unix and Windows runner forms and account for the stated runner version requirement. Done means the recipe handles the replacement and warns users about runner compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, yaml
Domain
ci-cd, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.