Claude-skill-registry github-script
Best practices for writing JavaScript code for GitHub Actions using github-script
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/github-script" ~/.claude/skills/majiayu000-claude-skill-registry-github-script && rm -rf "$T"
manifest:
skills/data/github-script/SKILL.mdsource content
GitHub Action Script Best Practices
This skill provides guidelines for writing JavaScript files that run using the GitHub Action
actions/github-script@v8.
Important Notes
- This action provides
and@actions/core
packages globally@actions/github - Do not add import or require for
@actions/core - Reference documentation:
Best Practices
- Use
,core.info
,core.warning
for logging, notcore.error
orconsole.logconsole.error - Use
to set action outputscore.setOutput - Use
to set environment variables for subsequent stepscore.exportVariable - Use
to get action inputs, withcore.getInput
for mandatory inputsrequired: true - Use
to mark the action as failed with an error messagecore.setFailed
Step Summary
Use
core.summary.* function to write output the step summary file.
- Use
to add raw Markdown content (GitHub Flavored Markdown supported)core.summary.addRaw() - Make sure to call
to flush pending writescore.summary.write() - Summary function calls can be chained, e.g.
core.summary.addRaw(...).addRaw(...).write()
Common Errors
- Avoid
type as much as possible, use specific types orany
insteadunknown - Catch handler: check if error is an instance of Error before accessing message property
catch (error) { core.setFailed(error instanceof Error ? error : String(error)); }
also callscore.setFailed
, so do not call bothcore.error
Typechecking
Run
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.