@happyvertical/github-actions

中文文档
0.113.1发布于 2026/11/17MITTypeScriptES Module近 30 天下载 5543

Reusable GitHub Actions utilities for issue triage, PR validation, and workflow automation

原始使用文档
文档目录12 节
  1. Installation
  2. CLI Usage
  3. Triage
  4. Labels
  5. Configuration
  6. Programmatic API
  7. Issue Triage
  8. Planning
  9. Label Management
  10. Shared Utilities
  11. Architecture
  12. License

@happyvertical/github-actions

GitHub Actions utilities for CI/CD automation. Provides AI-powered issue triage (labeling, duplicate detection, project board management), implementation planning with Definition of Ready validation, and standardized label management. Uses @happyvertical/repos and @happyvertical/projects for GitHub API interactions.

Installation

npm install @happyvertical/github-actions

Peer dependencies: @happyvertical/repos, @happyvertical/projects.

CLI Usage

The package provides two CLI commands:

Triage

Run AI-powered issue triage in a GitHub Actions workflow:

# Required env vars: GITHUB_TOKEN, GITHUB_REPOSITORY, ISSUE_NUMBER, ISSUE_TITLE, ISSUE_AUTHOR
# Optional: ISSUE_BODY, CONFIG (path to config file or JSON string)
npx @happyvertical/github-actions triage

Labels

Apply standardized labels (type, priority, size, status, agent) to a repository:

github-actions labels --owner happyvertical --repo sdk --dry-run
github-actions labels --owner happyvertical --repo sdk --include-area --area core --area api

Configuration

Create a .github/triage-config.json:

{
  "repoDescription": "TypeScript monorepo for AI agent development",
  "packagePattern": "@happyvertical/*",
  "packageExamples": ["@happyvertical/ai", "@happyvertical/sql"],
  "projectEnabled": true,
  "projectId": "PVT_kwDOB9Y8ns4A8-TY",
  "statusFieldId": "PVTSSF_lADOB9Y8ns4A8-TYzgw0GaY",
  "statusOptions": {
    "To Do": "c0c9ab27",
    "In Progress": "ce670088",
    "Review & Testing": "ee1f96bd"
  }
}
FieldTypeRequiredDescription
repoDescriptionstringYesBrief description for AI context
packagePatternstringNoMonorepo package pattern (e.g., @happyvertical/*)
packageExamplesstring[]NoExample package names for AI guidance
projectEnabledbooleanNoEnable GitHub Projects V2 integration
projectIdstringIf projectProject V2 ID
statusFieldIdstringIf projectStatus field ID
statusOptionsobjectIf projectStatus name to option ID mapping

Programmatic API

Issue Triage

import { triageIssue } from '@happyvertical/github-actions';

const result = await triageIssue({
  token: process.env.GITHUB_TOKEN!,
  owner: 'happyvertical',
  repo: 'sdk',
  issueNumber: 123,
  issueTitle: 'Add Redis cache support',
  issueBody: 'We need distributed caching...',
  issueAuthor: 'username',
  config: {
    repoDescription: 'TypeScript monorepo for AI agent development',
    packagePattern: '@happyvertical/*',
    projectEnabled: false,
  },
});

Triage analyzes the issue with AI (GitHub Models API), applies type/priority/size labels, searches for duplicates, posts a structured comment, and optionally updates the project board.

Planning

import { startPlanning, completePlanning } from '@happyvertical/github-actions';

// Generate an AI implementation plan and post it as a comment
const planResult = await startPlanning(context);

// Validate Definition of Ready and move to Ready status
const completeResult = await completePlanning(context);

Label Management

import {
  getAllStandardLabels,
  getLabelsByCategory,
  migrateLabel,
} from '@happyvertical/github-actions';

const allLabels = getAllStandardLabels(); // type, priority, size, status, agent
const bugLabels = getLabelsByCategory('type');
const newName = migrateLabel('enhancement'); // → 'type: feature'

Shared Utilities

import {
  createRepository,
  createProject,
  getAICompletion,
  parseAIJson,
} from '@happyvertical/github-actions';

// Adapter factories for @happyvertical/repos and @happyvertical/projects
const repo = await createRepository(token, 'happyvertical', 'sdk');
const project = await createProject(token, projectId, statusFieldId, statusOptions);

// AI completion with auto-provider selection (GitHub Models → OpenAI → Anthropic)
const response = await getAICompletion([
  { role: 'system', content: 'You are a helpful assistant.' },
  { role: 'user', content: 'Analyze this issue...' },
]);

Architecture

  • triage/ — Issue triage: AI analysis, labeling, duplicate detection, project board updates
  • planning/ — Implementation planning: AI plan generation, Definition of Ready validation
  • shared/ — AI client (GitHub Models, OpenAI, Anthropic), GitHub API helpers, label definitions, project utilities, adapter factories
  • cli.ts — CLI entry point (triage, labels commands)

License

MIT

版本与发布记录

@happyvertical/github-actions 共发布 132 个版本,首次发布于 2026/06/23;过去 12 个月发布了 132 个版本。

版本发布日期距今
0.113.1latest2026/11/17今天
0.113.02026/11/152 天前
0.112.32026/11/134 天前
0.112.22026/11/125 天前
0.112.02026/11/125 天前
0.112.12026/11/125 天前

关于 @happyvertical/github-actions 的常见问题

@happyvertical/github-actions 是什么?

Reusable GitHub Actions utilities for issue triage, PR validation, and workflow automation

如何安装 @happyvertical/github-actions?

在项目目录运行 npm install @happyvertical/github-actions,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 github-actions、have-github-actions-context,可以用 npx github-actions 直接运行。

@happyvertical/github-actions 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@happyvertical/github-actions 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@happyvertical/github-actions 可以商用吗?

@happyvertical/github-actions 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@happyvertical/github-actions 的下载量有多少?

根据 npm 官方下载统计,@happyvertical/github-actions 在 2026/10/17 – 2026/11/15 这 30 天内被下载 5,543 次,日均约 185 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@happyvertical/github-actions 还在维护吗?

最新版本 0.113.1 发布于 2026/11/17(今天);至今共发布 132 个版本,其中过去 12 个月发布了 132 个;首次发布于 2026/06/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。