saveState function Null safety

void saveState(
  1. String name,
  2. String value
)

You can use this command to create environment variables for sharing with your workflow's pre: or post: actions.

For example, you can create a file with the pre: action, pass the file location to the main: action, and then use the post: action to delete the file. Alternatively, you could create a file with the main: action, pass the file location to the post: action, and also use the post: action to delete the file.

If you have multiple pre: or post: actions, you can only access the saved value in the action where save-state was used.

For more information on the post: action, see "Metadata syntax for GitHub Actions.".

The saved value is not available to YAML files. It is stored as an environment value with the STATE_ prefix.

Implementation

void saveState(String name, String value) {
  _echo('save-state', value, {'name': name});
}