github-script

Solid

Write robust JavaScript for GitHub Actions github-script steps.

Code & Development 4,612 stars 420 forks Updated today MIT

Install

View on GitHub

Quality Score: 89/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
85
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# GitHub Action Script Best Practices Use these guidelines for JavaScript executed by `actions/github-script@v8`. ## Important Notes - This action provides `@actions/core` and `@actions/github` packages globally - Do not add import or require for `@actions/core` - Reference documentation: - https://github.com/actions/toolkit/blob/main/packages/core/README.md - https://github.com/actions/toolkit/blob/main/packages/github/README.md ## 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 ```js catch (error) { core.setFailed(error instanceof Error ? error : String(error)); } ``` - `core.setFailed` also call...

Details

Author
github
Repository
github/gh-aw
Created
10 months ago
Last Updated
today
Language
Go
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category