Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Write robust JavaScript for GitHub Actions github-script steps.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 137% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 8% | 0% |
Use these guidelines for JavaScript executed by actions/github-script@v8.
@actions/core and @actions/github packages globally@actions/core core.info, core.warning, core.error for logging, not console.log or console.errorcore.setOutput to set action outputscore.exportVariable to set environment variables for subsequent stepscore.getInput to get action inputs, with required: true for mandatory inputscore.setFailed to mark the action as failed with an error messageUse core.summary.* function to write output the step summary file.
core.summary.addRaw() to add raw Markdown content (GitHub Flavored Markdown supported)core.summary.write() to flush pending writescore.summary.addRaw(...).addRaw(...).write()any type as much as possible, use specific types or unknown insteadjscatch (error) { core.setFailed(error instanceof Error ? error : String(error)); }
core.setFailed also calls core.error, so do not call bothRun make js to run the typescript compiler.
Run make lint-cjs to lint the files.
Run make fmt-cjs after editing to format the file.
Other measured skills in the registry, with their headline benchmark lift.