github-script | Skill Performance & Reviews | TopRankSkills

TopRank Skills

Home / Skills / tools / github-script

github-script

maintained by githubnext

star 331 account_tree 37 verified_user MIT License
bolt View GitHub

name: github-script description: Best practices for writing JavaScript code for GitHub Actions using github-script

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

Best Practices

  • Use core.info, core.warning, core.error for logging, not console.log or console.error
  • Use core.setOutput to set action outputs
  • Use core.exportVariable to set environment variables for subsequent steps
  • Use core.getInput to get action inputs, with required: true for mandatory inputs
  • Use core.setFailed to mark the action as failed with an error message

Step Summary

Use core.summary.* function to write output the step summary file.

  • Use core.summary.addRaw() to add raw Markdown content (GitHub Flavored Markdown supported)
  • Make sure to call core.summary.write() to flush pending writes
  • Summary function calls can be chained, e.g. core.summary.addRaw(...).addRaw(...).write()

Common Errors

  • Avoid any type as much as possible, use specific types or unknown instead
  • Catch handler: check if error is an instance of Error before accessing message property
catch (error) {
  core.setFailed(error instanceof Error ? error : String(error));
}
  • core.setFailed also calls core.error, so do not call both

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.

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!

Skill Details

GitHub Stars 331
GitHub Forks 37
Created Jan 2026
Last Updated 4个月前
tools tools automation tools

Related Skills

planning-with-files
chevron_right
agent-browser
chevron_right
specs-gen
chevron_right
building-agents
chevron_right
pr

pr

MoonshotAI
star 6.1k
chevron_right

Build your own?

Join 12,000+ developers contributing to the Claude ecosystem.