github-script

Write GitHub Actions JavaScript using github-script@v8 core APIs.

4.9k|489|Updated Aug 12, 2025
One-click install
npx skills add https://github.com/githubnext/gh-aw --skill github-script
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-script
Source: https://github.com/githubnext/gh-aw/tree/main/skills/github-script
Command: npx skills add https://github.com/githubnext/gh-aw --skill github-script

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides developers in writing high-quality, robust JavaScript code for GitHub Actions using actions/github-script@v8, preventing common errors and ensuring reliable automation. It helps streamline the development of custom action logic.

Core Features & Use Cases

  • Standardized Logging: Use core.info, core.warning, and core.error for consistent and effective logging.
  • Input/Output Management: Learn to set action outputs (core.setOutput), export environment variables (core.exportVariable), and retrieve inputs (core.getInput).
  • Robust Error Handling: Implement core.setFailed for clear action failure reporting and proper error catching.
  • Step Summary Generation: Utilize core.summary.* functions to create rich, informative step summaries in Markdown.
  • Use Case: A developer needs to write a JavaScript action that processes an input and sets an output. This skill guides them to use core.getInput and core.setOutput correctly, along with proper error handling.

Quick Start

Consult the github-script skill to learn how to use core.info for logging and core.setOutput to define outputs in your GitHub Action JavaScript.

Frequently Asked Questions about github-script

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write JavaScript for GitHub Actions with proper logging and error handling?

Use the @actions/core library to write JavaScript in GitHub Actions: call core.info, core.warning, and core.error for logging; core.getInput to read inputs; core.setOutput to set outputs; and core.setFailed to report action failures with clear error messages.

What's the best way to set outputs and retrieve inputs in a GitHub Actions JavaScript workflow?

Retrieve action inputs with core.getInput and set outputs with core.setOutput. Both are part of @actions/core and are globally available in github-script@v8 without requiring explicit imports, ensuring standardized workflows.

How do I handle errors reliably in GitHub Actions JavaScript code?

Implement robust error handling by wrapping code in try-catch blocks and calling core.setFailed with a descriptive error message. This ensures the action exits with a clear failure status and prevents silent failures in your workflow.

Can I generate step summaries in GitHub Actions using JavaScript?

Yes, use core.summary functions to write rich Markdown-formatted step summaries directly in GitHub Actions. This creates informative, formatted output visible in workflow run logs without requiring additional tools.

Do I need to import @actions/core in github-script@v8, or is it already available?

Do not import @actions/core in github-script@v8; it is globally available as the core object. Importing it will cause conflicts. Access all core APIs—info, warning, error, getInput, setOutput, exportVariable, and setFailed—directly without imports.

How do I export environment variables from a GitHub Actions JavaScript action?

Use core.exportVariable to set environment variables accessible to subsequent steps in your workflow. This is the standardized approach in github-script@v8 for making variables persistent across action steps.