actions / actions/toolkit

Improved documentation around sequence of saveState and getState

Open
#854 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Upon writing my first action, I found it surprising that after issuing a call like core.saveState('foo', 'bar') I could not immediately core.getState('foo') back from the environment. After reading the code a bit, I sort of understand why. Although core.getState is reading directly from the environment variables, core.saveState is writing to stdout.

The docs for sending values to pre and post actions implies this. (emphasis mine)

The STATE_processID variable is then exclusively available to the cleanup script running under the main action.

It would be nice if the documentation around core.saveState and core.getState explicitly mentioned this. I didn't initially expect this behavior.

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 with the documentation for core.saveState and core.getState and compare it with the linked GitHub Actions workflow-commands reference. Update the documentation to explain that saveState writes to stdout and its value is not immediately available through getState, including the pre/post action scope. Done means the sequence and limitation are explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.