github-script
Best practices for writing JavaScript code for GitHub Actions using github-script
Best use case
github-script is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Best practices for writing JavaScript code for GitHub Actions using github-script
Teams using github-script should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/github-script/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How github-script Compares
| Feature / Agent | github-script | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Best practices for writing JavaScript code for GitHub Actions using github-script
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agent for YouTube Script Writing
Find AI agent skills for YouTube script writing, video research, content outlining, and repeatable channel production workflows.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
# 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 `@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 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.Related Skills
javascript-refactoring
Instructions for refactoring JavaScript code into separate files
github-pr-query
Query GitHub pull requests efficiently with jq argument support for filtering
github-mcp-server
GitHub MCP Server Documentation
github-issue-query
Query GitHub issues efficiently with jq argument support for filtering
github-discussion-query
Query GitHub discussions efficiently with jq argument support for filtering
github-copilot-agent-tips-and-tricks
Tips and Tricks for Working with GitHub Copilot Agent PRs
temporary-id-safe-output
Plan for adding temporary ID support to safe output jobs
skills
Using Skillz MCP Server with Docker
reporting
Guidelines for formatting reports using HTML details/summary tags
messages
Instructions for adding new message types to the safe-output messages system
http_mcp_headers
HTTP MCP Header Secret Support - Implementation Summary
gh-agent-task
GitHub CLI Agent Task Extension