github/gh-aw✦ 精选0°

github-script

仓库创建 2025年8月13日最近提交 2 小时前SkillHot 收录 1 小时前
▸ 精选理由

提高 Actions 步骤脚本的鲁棒性与一致性,适合 CI 作者。

这个 Skill 做什么

为 actions/github-script 中的 JavaScript 提供编写与运行最佳实践。

提供在 GitHub Actions 中通过 actions/github-script 步骤跑 JavaScript 的实战建议和注意事项。适合在 workflow 里直接写 JS、又不想踩环境或依赖坑时参考,比如不要重复导入 @actions/core、正确使用提供的上下文和返回约定等。能让脚本更健壮,减少因环境差异导致的失败。

▸ 展开 SKILL.md 英文原文

Write robust JavaScript for GitHub Actions github-script steps.

Skill 开发管理GitHub ActionsJS最佳实践通用
4.9k
Stars
482
Forks
40
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/github/gh-aw/main/.github/skills/github-script/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/github/gh-aw/main/.github/skills/github-script/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# 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.getIn
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有