Core: Add stopCommands/resumeCommands functions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the enhancement
actions/runner supports the stop-commands workflow command, which can be used to temporarily suspend workflow command processing. This is useful to avoid command execution when logging something that might contain workflow commands (eg untrusted data).
@actions/core doesn't currently have functions to use this feature, so javascript actions need to use the following technique:
import {v4 as uuidv4} from 'uuid'
// disable workflow commands
const token = uuidv4()
console.log(`::stop-commands::${token}`)
// log untrusted output
console.log("untrusted output")
// enable workflow commands
console.log(`::${token}::`)
Unfortunately the only place that method is documented is in this blog post: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
I think it would be helpful to add stopCommands/resumeCommands functions to @actions/core.
stopCommands could generate a random token by default, and save/return it for resumeCommands to use. That would make it easy to follow best practice for the use of these commands.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names @actions/core but does not identify a source file or test. Start by locating the existing workflow-command handling in @actions/core and its related tests, then verify how stopCommands and resumeCommands should expose the token behavior described here. Done means JavaScript actions can use both functions without manually generating UUIDs or logging command strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ci-cd, devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100