github-workflow-automation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Workflow Automation Skill

GitHub工作流自动化技能

Overview

概述

This skill provides comprehensive GitHub Actions automation with AI swarm coordination. It integrates intelligent CI/CD pipelines, workflow orchestration, and repository management to create self-organizing, adaptive GitHub workflows.
该技能提供结合AI集群协作的全面GitHub Actions自动化能力。它集成智能CI/CD流水线、工作流编排和仓库管理功能,打造自组织、自适应的GitHub工作流。

Quick Start

快速开始

<details> <summary>💡 Basic Usage - Click to expand</summary>
<details> <summary>💡 基础用法 - 点击展开</summary>

Initialize GitHub Workflow Automation

初始化GitHub工作流自动化

bash
undefined
bash
undefined

Start with a simple workflow

启动简单工作流

npx ruv-swarm actions generate-workflow
--analyze-codebase
--detect-languages
--create-optimal-pipeline
undefined
npx ruv-swarm actions generate-workflow
--analyze-codebase
--detect-languages
--create-optimal-pipeline
undefined

Common Commands

常用命令

bash
undefined
bash
undefined

Optimize existing workflow

优化现有工作流

npx ruv-swarm actions optimize
--workflow ".github/workflows/ci.yml"
--suggest-parallelization
npx ruv-swarm actions optimize
--workflow ".github/workflows/ci.yml"
--suggest-parallelization

Analyze failed runs

分析失败运行记录

gh run view <run-id> --json jobs,conclusion |
npx ruv-swarm actions analyze-failure
--suggest-fixes

</details>
gh run view <run-id> --json jobs,conclusion |
npx ruv-swarm actions analyze-failure
--suggest-fixes

</details>

Core Capabilities

核心功能

🤖 Swarm-Powered GitHub Modes

🤖 基于集群的GitHub模式

<details> <summary>Available GitHub Integration Modes</summary>
<details> <summary>可用的GitHub集成模式</summary>

1. gh-coordinator

1. gh-coordinator

GitHub workflow orchestration and coordination
  • Coordination Mode: Hierarchical
  • Max Parallel Operations: 10
  • Batch Optimized: Yes
  • Best For: Complex GitHub workflows, multi-repo coordination
bash
undefined
GitHub工作流编排与协作
  • 协作模式:分层式
  • 最大并行操作数:10
  • 批量优化:支持
  • 适用场景:复杂GitHub工作流、多仓库协作
bash
undefined

Usage example

使用示例

npx claude-flow@alpha github gh-coordinator
"Coordinate multi-repo release across 5 repositories"
undefined
npx claude-flow@alpha github gh-coordinator
"Coordinate multi-repo release across 5 repositories"
undefined

2. pr-manager

2. pr-manager

Pull request management and review coordination
  • Review Mode: Automated
  • Multi-reviewer: Yes
  • Conflict Resolution: Intelligent
bash
undefined
拉取请求管理与评审协作
  • 评审模式:自动化
  • 多评审人:支持
  • 冲突解决:智能处理
bash
undefined

Create PR with automated review

创建带自动化评审的PR

gh pr create --title "Feature: New capability"
--body "Automated PR with swarm review" |
npx ruv-swarm actions pr-validate
--spawn-agents "linter,tester,security,docs"
undefined
gh pr create --title "Feature: New capability"
--body "Automated PR with swarm review" |
npx ruv-swarm actions pr-validate
--spawn-agents "linter,tester,security,docs"
undefined

3. issue-tracker

3. issue-tracker

Issue management and project coordination
  • Issue Workflow: Automated
  • Label Management: Smart
  • Progress Tracking: Real-time
bash
undefined
问题管理与项目协作
  • 问题工作流:自动化
  • 标签管理:智能分类
  • 进度跟踪:实时同步
bash
undefined

Create coordinated issue workflow

创建协同化问题工作流

npx claude-flow@alpha github issue-tracker
"Manage sprint issues with automated tracking"
undefined
npx claude-flow@alpha github issue-tracker
"Manage sprint issues with automated tracking"
undefined

4. release-manager

4. release-manager

Release coordination and deployment
  • Release Pipeline: Automated
  • Versioning: Semantic
  • Deployment: Multi-stage
bash
undefined
发布协作与部署
  • 发布流水线:自动化
  • 版本管理:语义化版本
  • 部署:多阶段执行
bash
undefined

Automated release management

自动化发布管理

npx claude-flow@alpha github release-manager
"Create v2.0.0 release with changelog and deployment"
undefined
npx claude-flow@alpha github release-manager
"Create v2.0.0 release with changelog and deployment"
undefined

5. repo-architect

5. repo-architect

Repository structure and organization
  • Structure Optimization: Yes
  • Multi-repo Support: Yes
  • Template Management: Advanced
bash
undefined
仓库结构与组织
  • 结构优化:支持
  • 多仓库适配:支持
  • 模板管理:高级功能
bash
undefined

Optimize repository structure

优化仓库结构

npx claude-flow@alpha github repo-architect
"Restructure monorepo with optimal organization"
undefined
npx claude-flow@alpha github repo-architect
"Restructure monorepo with optimal organization"
undefined

6. code-reviewer

6. code-reviewer

Automated code review and quality assurance
  • Review Quality: Deep
  • Security Analysis: Yes
  • Performance Check: Automated
bash
undefined
自动化代码评审与质量保障
  • 评审深度:全面分析
  • 安全检测:支持
  • 性能检查:自动化
bash
undefined

Automated code review

自动化代码评审

gh pr view 123 --json files |
npx ruv-swarm actions pr-validate
--deep-review
--security-scan
undefined
gh pr view 123 --json files |
npx ruv-swarm actions pr-validate
--deep-review
--security-scan
undefined

7. ci-orchestrator

7. ci-orchestrator

CI/CD pipeline coordination
  • Pipeline Management: Advanced
  • Test Coordination: Parallel
  • Deployment: Automated
bash
undefined
CI/CD流水线协作
  • 流水线管理:高级功能
  • 测试协作:并行执行
  • 部署:自动化
bash
undefined

Orchestrate CI/CD pipeline

编排CI/CD流水线

npx claude-flow@alpha github ci-orchestrator
"Setup parallel test execution with smart caching"
undefined
npx claude-flow@alpha github ci-orchestrator
"Setup parallel test execution with smart caching"
undefined

8. security-guardian

8. security-guardian

Security and compliance management
  • Security Scan: Automated
  • Compliance Check: Continuous
  • Vulnerability Management: Proactive
bash
undefined
安全与合规管理
  • 安全扫描:自动化
  • 合规检查:持续执行
  • 漏洞管理:主动防护
bash
undefined

Security audit

安全审计

npx ruv-swarm actions security
--deep-scan
--compliance-check
--create-issues

</details>
npx ruv-swarm actions security
--deep-scan
--compliance-check
--create-issues

</details>

🔧 Workflow Templates

🔧 工作流模板

<details> <summary>Production-Ready GitHub Actions Templates</summary>
<details> <summary>生产级GitHub Actions模板</summary>

1. Intelligent CI with Swarms

1. 智能CI集群

yaml
undefined
yaml
undefined

.github/workflows/swarm-ci.yml

.github/workflows/swarm-ci.yml

name: Intelligent CI with Swarms on: [push, pull_request]
jobs: swarm-analysis: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
  - name: Initialize Swarm
    uses: ruvnet/swarm-action@v1
    with:
      topology: mesh
      max-agents: 6

  - name: Analyze Changes
    run: |
      npx ruv-swarm actions analyze \
        --commit ${{ github.sha }} \
        --suggest-tests \
        --optimize-pipeline
undefined
name: Intelligent CI with Swarms on: [push, pull_request]
jobs: swarm-analysis: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
  - name: Initialize Swarm
    uses: ruvnet/swarm-action@v1
    with:
      topology: mesh
      max-agents: 6

  - name: Analyze Changes
    run: |
      npx ruv-swarm actions analyze \
        --commit ${{ github.sha }} \
        --suggest-tests \
        --optimize-pipeline
undefined

2. Multi-Language Detection

2. 多语言检测

yaml
undefined
yaml
undefined

.github/workflows/polyglot-swarm.yml

.github/workflows/polyglot-swarm.yml

name: Polyglot Project Handler on: push
jobs: detect-and-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
  - name: Detect Languages
    id: detect
    run: |
      npx ruv-swarm actions detect-stack \
        --output json > stack.json

  - name: Dynamic Build Matrix
    run: |
      npx ruv-swarm actions create-matrix \
        --from stack.json \
        --parallel-builds
undefined
name: Polyglot Project Handler on: push
jobs: detect-and-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
  - name: Detect Languages
    id: detect
    run: |
      npx ruv-swarm actions detect-stack \
        --output json > stack.json

  - name: Dynamic Build Matrix
    run: |
      npx ruv-swarm actions create-matrix \
        --from stack.json \
        --parallel-builds
undefined

3. Adaptive Security Scanning

3. 自适应安全扫描

yaml
undefined
yaml
undefined

.github/workflows/security-swarm.yml

.github/workflows/security-swarm.yml

name: Intelligent Security Scan on: schedule: - cron: '0 0 * * *' workflow_dispatch:
jobs: security-swarm: runs-on: ubuntu-latest steps: - name: Security Analysis Swarm run: | SECURITY_ISSUES=$(npx ruv-swarm actions security
--deep-scan
--format json)
      echo "$SECURITY_ISSUES" | jq -r '.issues[]? | @base64' | while read -r issue; do
        _jq() {
          echo ${issue} | base64 --decode | jq -r ${1}
        }
        gh issue create \
          --title "$(_jq '.title')" \
          --body "$(_jq '.body')" \
          --label "security,critical"
      done
undefined
name: Intelligent Security Scan on: schedule: - cron: '0 0 * * *' workflow_dispatch:
jobs: security-swarm: runs-on: ubuntu-latest steps: - name: Security Analysis Swarm run: | SECURITY_ISSUES=$(npx ruv-swarm actions security
--deep-scan
--format json)
      echo "$SECURITY_ISSUES" | jq -r '.issues[]? | @base64' | while read -r issue; do
        _jq() {
          echo ${issue} | base64 --decode | jq -r ${1}
        }
        gh issue create \
          --title "$(_jq '.title')" \
          --body "$(_jq '.body')" \
          --label "security,critical"
      done
undefined

4. Self-Healing Pipeline

4. 自修复流水线

yaml
undefined
yaml
undefined

.github/workflows/self-healing.yml

.github/workflows/self-healing.yml

name: Self-Healing Pipeline on: workflow_run
jobs: heal-pipeline: if: ${{ github.event.workflow_run.conclusion == 'failure' }} runs-on: ubuntu-latest steps: - name: Diagnose and Fix run: | npx ruv-swarm actions self-heal
--run-id ${{ github.event.workflow_run.id }}
--auto-fix-common
--create-pr-complex
undefined
name: Self-Healing Pipeline on: workflow_run
jobs: heal-pipeline: if: ${{ github.event.workflow_run.conclusion == 'failure' }} runs-on: ubuntu-latest steps: - name: Diagnose and Fix run: | npx ruv-swarm actions self-heal
--run-id ${{ github.event.workflow_run.id }}
--auto-fix-common
--create-pr-complex
undefined

5. Progressive Deployment

5. 渐进式部署

yaml
undefined
yaml
undefined

.github/workflows/smart-deployment.yml

.github/workflows/smart-deployment.yml

name: Smart Deployment on: push: branches: [main]
jobs: progressive-deploy: runs-on: ubuntu-latest steps: - name: Analyze Risk id: risk run: | npx ruv-swarm actions deploy-risk
--changes ${{ github.sha }}
--history 30d
  - name: Choose Strategy
    run: |
      npx ruv-swarm actions deploy-strategy \
        --risk ${{ steps.risk.outputs.level }} \
        --auto-execute
undefined
name: Smart Deployment on: push: branches: [main]
jobs: progressive-deploy: runs-on: ubuntu-latest steps: - name: Analyze Risk id: risk run: | npx ruv-swarm actions deploy-risk
--changes ${{ github.sha }}
--history 30d
  - name: Choose Strategy
    run: |
      npx ruv-swarm actions deploy-strategy \
        --risk ${{ steps.risk.outputs.level }} \
        --auto-execute
undefined

6. Performance Regression Detection

6. 性能回归检测

yaml
undefined
yaml
undefined

.github/workflows/performance-guard.yml

.github/workflows/performance-guard.yml

name: Performance Guard on: pull_request
jobs: perf-swarm: runs-on: ubuntu-latest steps: - name: Performance Analysis run: | npx ruv-swarm actions perf-test
--baseline main
--threshold 10%
--auto-profile-regression
undefined
name: Performance Guard on: pull_request
jobs: perf-swarm: runs-on: ubuntu-latest steps: - name: Performance Analysis run: | npx ruv-swarm actions perf-test
--baseline main
--threshold 10%
--auto-profile-regression
undefined

7. PR Validation Swarm

7. PR验证集群

yaml
undefined
yaml
undefined

.github/workflows/pr-validation.yml

.github/workflows/pr-validation.yml

name: PR Validation Swarm on: pull_request
jobs: validate: runs-on: ubuntu-latest steps: - name: Multi-Agent Validation run: | PR_DATA=$(gh pr view ${{ github.event.pull_request.number }} --json files,labels)
      RESULTS=$(npx ruv-swarm actions pr-validate \
        --spawn-agents "linter,tester,security,docs" \
        --parallel \
        --pr-data "$PR_DATA")

      gh pr comment ${{ github.event.pull_request.number }} \
        --body "$RESULTS"
undefined
name: PR Validation Swarm on: pull_request
jobs: validate: runs-on: ubuntu-latest steps: - name: Multi-Agent Validation run: | PR_DATA=$(gh pr view ${{ github.event.pull_request.number }} --json files,labels)
      RESULTS=$(npx ruv-swarm actions pr-validate \
        --spawn-agents "linter,tester,security,docs" \
        --parallel \
        --pr-data "$PR_DATA")

      gh pr comment ${{ github.event.pull_request.number }} \
        --body "$RESULTS"
undefined

8. Intelligent Release

8. 智能发布

yaml
undefined
yaml
undefined

.github/workflows/intelligent-release.yml

.github/workflows/intelligent-release.yml

name: Intelligent Release on: push: tags: ['v*']
jobs: release: runs-on: ubuntu-latest steps: - name: Release Swarm run: | npx ruv-swarm actions release
--analyze-changes
--generate-notes
--create-artifacts
--publish-smart

</details>
name: Intelligent Release on: push: tags: ['v*']
jobs: release: runs-on: ubuntu-latest steps: - name: Release Swarm run: | npx ruv-swarm actions release
--analyze-changes
--generate-notes
--create-artifacts
--publish-smart

</details>

📊 Monitoring & Analytics

📊 监控与分析

<details> <summary>Workflow Analysis & Optimization</summary>
<details> <summary>工作流分析与优化</summary>

Workflow Analytics

工作流分析

bash
undefined
bash
undefined

Analyze workflow performance

分析工作流性能

npx ruv-swarm actions analytics
--workflow "ci.yml"
--period 30d
--identify-bottlenecks
--suggest-improvements
undefined
npx ruv-swarm actions analytics
--workflow "ci.yml"
--period 30d
--identify-bottlenecks
--suggest-improvements
undefined

Cost Optimization

成本优化

bash
undefined
bash
undefined

Optimize GitHub Actions costs

优化GitHub Actions成本

npx ruv-swarm actions cost-optimize
--analyze-usage
--suggest-caching
--recommend-self-hosted
undefined
npx ruv-swarm actions cost-optimize
--analyze-usage
--suggest-caching
--recommend-self-hosted
undefined

Failure Pattern Analysis

失败模式分析

bash
undefined
bash
undefined

Identify failure patterns

识别失败模式

npx ruv-swarm actions failure-patterns
--period 90d
--classify-failures
--suggest-preventions
undefined
npx ruv-swarm actions failure-patterns
--period 90d
--classify-failures
--suggest-preventions
undefined

Resource Management

资源管理

bash
undefined
bash
undefined

Optimize resource usage

优化资源使用

npx ruv-swarm actions resources
--analyze-usage
--suggest-runners
--cost-optimize

</details>
npx ruv-swarm actions resources
--analyze-usage
--suggest-runners
--cost-optimize

</details>

Advanced Features

高级功能

🧪 Dynamic Test Strategies

🧪 动态测试策略

<details> <summary>Intelligent Test Selection & Execution</summary>
<details> <summary>智能测试选择与执行</summary>

Smart Test Selection

智能测试选择

yaml
undefined
yaml
undefined

Automatically select relevant tests

自动选择相关测试

  • name: Swarm Test Selection run: | npx ruv-swarm actions smart-test
    --changed-files ${{ steps.files.outputs.all }}
    --impact-analysis
    --parallel-safe
undefined
  • name: Swarm Test Selection run: | npx ruv-swarm actions smart-test
    --changed-files ${{ steps.files.outputs.all }}
    --impact-analysis
    --parallel-safe
undefined

Dynamic Test Matrix

动态测试矩阵

yaml
undefined
yaml
undefined

Generate test matrix from code analysis

通过代码分析生成测试矩阵

jobs: generate-matrix: outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - id: set-matrix run: | MATRIX=$(npx ruv-swarm actions test-matrix
--detect-frameworks
--optimize-coverage) echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
test: needs: generate-matrix strategy: matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
undefined
jobs: generate-matrix: outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - id: set-matrix run: | MATRIX=$(npx ruv-swarm actions test-matrix
--detect-frameworks
--optimize-coverage) echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
test: needs: generate-matrix strategy: matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
undefined

Intelligent Parallelization

智能并行化

bash
undefined
bash
undefined

Determine optimal parallelization

确定最优并行策略

npx ruv-swarm actions parallel-strategy
--analyze-dependencies
--time-estimates
--cost-aware

</details>
npx ruv-swarm actions parallel-strategy
--analyze-dependencies
--time-estimates
--cost-aware

</details>

🔮 Predictive Analysis

🔮 预测性分析

<details> <summary>AI-Powered Workflow Predictions</summary>
<details> <summary>AI驱动的工作流预测</summary>

Predictive Failures

故障预测

bash
undefined
bash
undefined

Predict potential failures

预测潜在故障

npx ruv-swarm actions predict
--analyze-history
--identify-risks
--suggest-preventive
undefined
npx ruv-swarm actions predict
--analyze-history
--identify-risks
--suggest-preventive
undefined

Workflow Recommendations

工作流建议

bash
undefined
bash
undefined

Get workflow recommendations

获取工作流建议

npx ruv-swarm actions recommend
--analyze-repo
--suggest-workflows
--industry-best-practices
undefined
npx ruv-swarm actions recommend
--analyze-repo
--suggest-workflows
--industry-best-practices
undefined

Automated Optimization

自动优化

bash
undefined
bash
undefined

Continuously optimize workflows

持续优化工作流

npx ruv-swarm actions auto-optimize
--monitor-performance
--apply-improvements
--track-savings

</details>
npx ruv-swarm actions auto-optimize
--monitor-performance
--apply-improvements
--track-savings

</details>

🎯 Custom Actions Development

🎯 自定义Action开发

<details> <summary>Build Your Own Swarm Actions</summary>
<details> <summary>构建您的专属集群Action</summary>

Custom Swarm Action Template

自定义集群Action模板

javascript
// action.yml
name: 'Swarm Custom Action'
description: 'Custom swarm-powered action'
inputs:
  task:
    description: 'Task for swarm'
    required: true
runs:
  using: 'node16'
  main: 'dist/index.js'

// index.js
const { SwarmAction } = require('ruv-swarm');

async function run() {
  const swarm = new SwarmAction({
    topology: 'mesh',
    agents: ['analyzer', 'optimizer']
  });

  await swarm.execute(core.getInput('task'));
}

run().catch(error => core.setFailed(error.message));
</details>
javascript
// action.yml
name: 'Swarm Custom Action'
description: 'Custom swarm-powered action'
inputs:
  task:
    description: 'Task for swarm'
    required: true
runs:
  using: 'node16'
  main: 'dist/index.js'

// index.js
const { SwarmAction } = require('ruv-swarm');

async function run() {
  const swarm = new SwarmAction({
    topology: 'mesh',
    agents: ['analyzer', 'optimizer']
  });

  await swarm.execute(core.getInput('task'));
}

run().catch(error => core.setFailed(error.message));
</details>

Integration with Claude-Flow

与Claude-Flow集成

🔄 Swarm Coordination Patterns

🔄 集群协作模式

<details> <summary>MCP-Based GitHub Workflow Coordination</summary>
<details> <summary>基于MCP的GitHub工作流协作</summary>

Initialize GitHub Swarm

初始化GitHub集群

javascript
// Step 1: Initialize swarm coordination
mcp__claude-flow__swarm_init {
  topology: "hierarchical",
  maxAgents: 8
}

// Step 2: Spawn specialized agents
mcp__claude-flow__agent_spawn { type: "coordinator", name: "GitHub Coordinator" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Code Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Agent" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Security Analyst" }

// Step 3: Orchestrate GitHub workflow
mcp__claude-flow__task_orchestrate {
  task: "Complete PR review and merge workflow",
  strategy: "parallel",
  priority: "high"
}
javascript
// Step 1: Initialize swarm coordination
mcp__claude-flow__swarm_init {
  topology: "hierarchical",
  maxAgents: 8
}

// Step 2: Spawn specialized agents
mcp__claude-flow__agent_spawn { type: "coordinator", name: "GitHub Coordinator" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Code Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Agent" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Security Analyst" }

// Step 3: Orchestrate GitHub workflow
mcp__claude-flow__task_orchestrate {
  task: "Complete PR review and merge workflow",
  strategy: "parallel",
  priority: "high"
}

GitHub Hooks Integration

GitHub钩子集成

bash
undefined
bash
undefined

Pre-task: Setup GitHub context

Pre-task: Setup GitHub context

npx claude-flow@alpha hooks pre-task
--description "PR review workflow"
--context "pr-123"
npx claude-flow@alpha hooks pre-task
--description "PR review workflow"
--context "pr-123"

During task: Track progress

During task: Track progress

npx claude-flow@alpha hooks notify
--message "Completed security scan"
--type "github-action"
npx claude-flow@alpha hooks notify
--message "Completed security scan"
--type "github-action"

Post-task: Export results

Post-task: Export results

npx claude-flow@alpha hooks post-task
--task-id "pr-review-123"
--export-github-summary

</details>
npx claude-flow@alpha hooks post-task
--task-id "pr-review-123"
--export-github-summary

</details>

📦 Batch Operations

📦 批量操作

<details> <summary>Concurrent GitHub Operations</summary>
<details> <summary>并发GitHub操作</summary>

Parallel GitHub CLI Commands

并行GitHub CLI命令

javascript
// Single message with all GitHub operations
[Concurrent Execution]:
  Bash("gh issue create --title 'Feature A' --body 'Description A' --label 'enhancement'")
  Bash("gh issue create --title 'Feature B' --body 'Description B' --label 'enhancement'")
  Bash("gh pr create --title 'PR 1' --head 'feature-a' --base 'main'")
  Bash("gh pr create --title 'PR 2' --head 'feature-b' --base 'main'")
  Bash("gh pr checks 123 --watch")
  TodoWrite { todos: [
    {content: "Review security scan results", status: "pending"},
    {content: "Merge approved PRs", status: "pending"},
    {content: "Update changelog", status: "pending"}
  ]}
</details>
javascript
// Single message with all GitHub operations
[Concurrent Execution]:
  Bash("gh issue create --title 'Feature A' --body 'Description A' --label 'enhancement'")
  Bash("gh issue create --title 'Feature B' --body 'Description B' --label 'enhancement'")
  Bash("gh pr create --title 'PR 1' --head 'feature-a' --base 'main'")
  Bash("gh pr create --title 'PR 2' --head 'feature-b' --base 'main'")
  Bash("gh pr checks 123 --watch")
  TodoWrite { todos: [
    {content: "Review security scan results", status: "pending"},
    {content: "Merge approved PRs", status: "pending"},
    {content: "Update changelog", status: "pending"}
  ]}
</details>

Best Practices

最佳实践

🏗️ Workflow Organization

🏗️ 工作流组织

<details> <summary>Structure Your GitHub Workflows</summary>
<details> <summary>结构化您的GitHub工作流</summary>

1. Use Reusable Workflows

1. 使用可复用工作流

yaml
undefined
yaml
undefined

.github/workflows/reusable-swarm.yml

.github/workflows/reusable-swarm.yml

name: Reusable Swarm Workflow on: workflow_call: inputs: topology: required: true type: string
jobs: swarm-task: runs-on: ubuntu-latest steps: - name: Initialize Swarm run: | npx ruv-swarm init --topology ${{ inputs.topology }}
undefined
name: Reusable Swarm Workflow on: workflow_call: inputs: topology: required: true type: string
jobs: swarm-task: runs-on: ubuntu-latest steps: - name: Initialize Swarm run: | npx ruv-swarm init --topology ${{ inputs.topology }}
undefined

2. Implement Proper Caching

2. 实现合理缓存

yaml
- name: Cache Swarm Dependencies
  uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-swarm-${{ hashFiles('**/package-lock.json') }}
yaml
- name: Cache Swarm Dependencies
  uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-swarm-${{ hashFiles('**/package-lock.json') }}

3. Set Appropriate Timeouts

3. 设置合适的超时时间

yaml
jobs:
  swarm-task:
    timeout-minutes: 30
    steps:
      - name: Swarm Operation
        timeout-minutes: 10
yaml
jobs:
  swarm-task:
    timeout-minutes: 30
    steps:
      - name: Swarm Operation
        timeout-minutes: 10

4. Use Workflow Dependencies

4. 使用工作流依赖

yaml
jobs:
  setup:
    runs-on: ubuntu-latest

  test:
    needs: setup
    runs-on: ubuntu-latest

  deploy:
    needs: [setup, test]
    runs-on: ubuntu-latest
</details>
yaml
jobs:
  setup:
    runs-on: ubuntu-latest

  test:
    needs: setup
    runs-on: ubuntu-latest

  deploy:
    needs: [setup, test]
    runs-on: ubuntu-latest
</details>

🔒 Security Best Practices

🔒 安全最佳实践

<details> <summary>Secure Your GitHub Workflows</summary>
<details> <summary>确保GitHub工作流安全</summary>

1. Store Configurations Securely

1. 安全存储配置

yaml
- name: Setup Swarm
  env:
    SWARM_CONFIG: ${{ secrets.SWARM_CONFIG }}
    API_KEY: ${{ secrets.API_KEY }}
  run: |
    npx ruv-swarm init --config "$SWARM_CONFIG"
yaml
- name: Setup Swarm
  env:
    SWARM_CONFIG: ${{ secrets.SWARM_CONFIG }}
    API_KEY: ${{ secrets.API_KEY }}
  run: |
    npx ruv-swarm init --config "$SWARM_CONFIG"

2. Use OIDC Authentication

2. 使用OIDC认证

yaml
permissions:
  id-token: write
  contents: read

- name: Configure AWS Credentials
  uses: aws-actions/configure-aws-credentials@v2
  with:
    role-to-assume: arn:aws:iam::123456789012:role/GitHubAction
    aws-region: us-east-1
yaml
permissions:
  id-token: write
  contents: read

- name: Configure AWS Credentials
  uses: aws-actions/configure-aws-credentials@v2
  with:
    role-to-assume: arn:aws:iam::123456789012:role/GitHubAction
    aws-region: us-east-1

3. Implement Least-Privilege

3. 实现最小权限原则

yaml
permissions:
  contents: read
  pull-requests: write
  issues: write
yaml
permissions:
  contents: read
  pull-requests: write
  issues: write

4. Audit Swarm Operations

4. 审计集群操作

yaml
- name: Audit Swarm Actions
  run: |
    npx ruv-swarm actions audit \
      --export-logs \
      --compliance-report
</details>
yaml
- name: Audit Swarm Actions
  run: |
    npx ruv-swarm actions audit \
      --export-logs \
      --compliance-report
</details>

⚡ Performance Optimization

⚡ 性能优化

<details> <summary>Maximize Workflow Performance</summary>
<details> <summary>最大化工作流性能</summary>

1. Cache Swarm Dependencies

1. 缓存集群依赖

yaml
- uses: actions/cache@v3
  with:
    path: |
      ~/.npm
      node_modules
    key: ${{ runner.os }}-swarm-${{ hashFiles('**/package-lock.json') }}
yaml
- uses: actions/cache@v3
  with:
    path: |
      ~/.npm
      node_modules
    key: ${{ runner.os }}-swarm-${{ hashFiles('**/package-lock.json') }}

2. Use Appropriate Runner Sizes

2. 使用合适的Runner规格

yaml
jobs:
  heavy-task:
    runs-on: ubuntu-latest-4-cores
    steps:
      - name: Intensive Swarm Operation
yaml
jobs:
  heavy-task:
    runs-on: ubuntu-latest-4-cores
    steps:
      - name: Intensive Swarm Operation

3. Implement Early Termination

3. 实现提前终止

yaml
- name: Quick Fail Check
  run: |
    if ! npx ruv-swarm actions pre-check; then
      echo "Pre-check failed, terminating early"
      exit 1
    fi
yaml
- name: Quick Fail Check
  run: |
    if ! npx ruv-swarm actions pre-check; then
      echo "Pre-check failed, terminating early"
      exit 1
    fi

4. Optimize Parallel Execution

4. 优化并行执行

yaml
strategy:
  matrix:
    include:
      - runner: ubuntu-latest
        task: test
      - runner: ubuntu-latest
        task: lint
      - runner: ubuntu-latest
        task: security
  max-parallel: 3
</details>
yaml
strategy:
  matrix:
    include:
      - runner: ubuntu-latest
        task: test
      - runner: ubuntu-latest
        task: lint
      - runner: ubuntu-latest
        task: security
  max-parallel: 3
</details>

Debugging & Troubleshooting

调试与故障排除

🐛 Debug Tools

🐛 调试工具

<details> <summary>Debug GitHub Workflow Issues</summary>
<details> <summary>调试GitHub工作流问题</summary>

Debug Mode

调试模式

yaml
- name: Debug Swarm
  run: |
    npx ruv-swarm actions debug \
      --verbose \
      --trace-agents \
      --export-logs
  env:
    ACTIONS_STEP_DEBUG: true
yaml
- name: Debug Swarm
  run: |
    npx ruv-swarm actions debug \
      --verbose \
      --trace-agents \
      --export-logs
  env:
    ACTIONS_STEP_DEBUG: true

Performance Profiling

性能分析

bash
undefined
bash
undefined

Profile workflow performance

分析工作流性能

npx ruv-swarm actions profile
--workflow "ci.yml"
--identify-slow-steps
--suggest-optimizations
undefined
npx ruv-swarm actions profile
--workflow "ci.yml"
--identify-slow-steps
--suggest-optimizations
undefined

Failure Analysis

故障分析

bash
undefined
bash
undefined

Analyze failed runs

分析失败运行记录

gh run view <run-id> --json jobs,conclusion |
npx ruv-swarm actions analyze-failure
--suggest-fixes
--auto-retry-flaky
undefined
gh run view <run-id> --json jobs,conclusion |
npx ruv-swarm actions analyze-failure
--suggest-fixes
--auto-retry-flaky
undefined

Log Analysis

日志分析

bash
undefined
bash
undefined

Download and analyze logs

下载并分析日志

gh run download <run-id> npx ruv-swarm actions analyze-logs
--directory ./logs
--identify-errors

</details>
gh run download <run-id> npx ruv-swarm actions analyze-logs
--directory ./logs
--identify-errors

</details>

Real-World Examples

实际应用示例

🚀 Complete Workflows

🚀 完整工作流

<details> <summary>Production-Ready Integration Examples</summary>
<details> <summary>生产级集成示例</summary>

Example 1: Full-Stack Application CI/CD

示例1:全栈应用CI/CD

yaml
name: Full-Stack CI/CD with Swarms
on:
  push:
    branches: [main, develop]
  pull_request:

jobs:
  initialize:
    runs-on: ubuntu-latest
    outputs:
      swarm-id: ${{ steps.init.outputs.swarm-id }}
    steps:
      - id: init
        run: |
          SWARM_ID=$(npx ruv-swarm init --topology mesh --output json | jq -r '.id')
          echo "swarm-id=${SWARM_ID}" >> $GITHUB_OUTPUT

  backend:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Backend Tests
        run: |
          npx ruv-swarm agents spawn --type tester \
            --task "Run backend test suite" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  frontend:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Frontend Tests
        run: |
          npx ruv-swarm agents spawn --type tester \
            --task "Run frontend test suite" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  security:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Security Scan
        run: |
          npx ruv-swarm agents spawn --type security \
            --task "Security audit" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  deploy:
    needs: [backend, frontend, security]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Deploy
        run: |
          npx ruv-swarm actions deploy \
            --strategy progressive \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}
yaml
name: Full-Stack CI/CD with Swarms
on:
  push:
    branches: [main, develop]
  pull_request:

jobs:
  initialize:
    runs-on: ubuntu-latest
    outputs:
      swarm-id: ${{ steps.init.outputs.swarm-id }}
    steps:
      - id: init
        run: |
          SWARM_ID=$(npx ruv-swarm init --topology mesh --output json | jq -r '.id')
          echo "swarm-id=${SWARM_ID}" >> $GITHUB_OUTPUT

  backend:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Backend Tests
        run: |
          npx ruv-swarm agents spawn --type tester \
            --task "Run backend test suite" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  frontend:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Frontend Tests
        run: |
          npx ruv-swarm agents spawn --type tester \
            --task "Run frontend test suite" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  security:
    needs: initialize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Security Scan
        run: |
          npx ruv-swarm agents spawn --type security \
            --task "Security audit" \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

  deploy:
    needs: [backend, frontend, security]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Deploy
        run: |
          npx ruv-swarm actions deploy \
            --strategy progressive \
            --swarm-id ${{ needs.initialize.outputs.swarm-id }}

Example 2: Monorepo Management

示例2:单体仓库管理

yaml
name: Monorepo Coordination
on: push

jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      packages: ${{ steps.detect.outputs.packages }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - id: detect
        run: |
          PACKAGES=$(npx ruv-swarm actions detect-changes \
            --monorepo \
            --output json)
          echo "packages=${PACKAGES}" >> $GITHUB_OUTPUT

  build-packages:
    needs: detect-changes
    runs-on: ubuntu-latest
    strategy:
      matrix:
        package: ${{ fromJson(needs.detect-changes.outputs.packages) }}
    steps:
      - name: Build Package
        run: |
          npx ruv-swarm actions build \
            --package ${{ matrix.package }} \
            --parallel-deps
yaml
name: Monorepo Coordination
on: push

jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      packages: ${{ steps.detect.outputs.packages }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - id: detect
        run: |
          PACKAGES=$(npx ruv-swarm actions detect-changes \
            --monorepo \
            --output json)
          echo "packages=${PACKAGES}" >> $GITHUB_OUTPUT

  build-packages:
    needs: detect-changes
    runs-on: ubuntu-latest
    strategy:
      matrix:
        package: ${{ fromJson(needs.detect-changes.outputs.packages) }}
    steps:
      - name: Build Package
        run: |
          npx ruv-swarm actions build \
            --package ${{ matrix.package }} \
            --parallel-deps

Example 3: Multi-Repo Synchronization

示例3:多仓库同步

bash
undefined
bash
undefined

Synchronize multiple repositories

Synchronize multiple repositories

npx claude-flow@alpha github sync-coordinator
"Synchronize version updates across:
  • github.com/org/repo-a
  • github.com/org/repo-b
  • github.com/org/repo-c
Update dependencies, align versions, create PRs"

</details>
npx claude-flow@alpha github sync-coordinator
"Synchronize version updates across:
  • github.com/org/repo-a
  • github.com/org/repo-b
  • github.com/org/repo-c
Update dependencies, align versions, create PRs"

</details>

Command Reference

命令参考

📚 Quick Command Guide

📚 快速命令指南

<details> <summary>All Available Commands</summary>
<details> <summary>所有可用命令</summary>

Workflow Generation

工作流生成

bash
npx ruv-swarm actions generate-workflow [options]
  --analyze-codebase       Analyze repository structure
  --detect-languages       Detect programming languages
  --create-optimal-pipeline Generate optimized workflow
bash
npx ruv-swarm actions generate-workflow [options]
  --analyze-codebase       Analyze repository structure
  --detect-languages       Detect programming languages
  --create-optimal-pipeline Generate optimized workflow

Optimization

优化

bash
npx ruv-swarm actions optimize [options]
  --workflow <path>        Path to workflow file
  --suggest-parallelization Suggest parallel execution
  --reduce-redundancy      Remove redundant steps
  --estimate-savings       Estimate time/cost savings
bash
npx ruv-swarm actions optimize [options]
  --workflow <path>        Path to workflow file
  --suggest-parallelization Suggest parallel execution
  --reduce-redundancy      Remove redundant steps
  --estimate-savings       Estimate time/cost savings

Analysis

分析

bash
npx ruv-swarm actions analyze [options]
  --commit <sha>           Analyze specific commit
  --suggest-tests          Suggest test improvements
  --optimize-pipeline      Optimize pipeline structure
bash
npx ruv-swarm actions analyze [options]
  --commit <sha>           Analyze specific commit
  --suggest-tests          Suggest test improvements
  --optimize-pipeline      Optimize pipeline structure

Testing

测试

bash
npx ruv-swarm actions smart-test [options]
  --changed-files <files>  Files that changed
  --impact-analysis        Analyze test impact
  --parallel-safe          Only parallel-safe tests
bash
npx ruv-swarm actions smart-test [options]
  --changed-files <files>  Files that changed
  --impact-analysis        Analyze test impact
  --parallel-safe          Only parallel-safe tests

Security

安全

bash
npx ruv-swarm actions security [options]
  --deep-scan             Deep security analysis
  --format <format>       Output format (json/text)
  --create-issues         Auto-create GitHub issues
bash
npx ruv-swarm actions security [options]
  --deep-scan             Deep security analysis
  --format <format>       Output format (json/text)
  --create-issues         Auto-create GitHub issues

Deployment

部署

bash
npx ruv-swarm actions deploy [options]
  --strategy <type>       Deployment strategy
  --risk <level>          Risk assessment level
  --auto-execute          Execute automatically
bash
npx ruv-swarm actions deploy [options]
  --strategy <type>       Deployment strategy
  --risk <level>          Risk assessment level
  --auto-execute          Execute automatically

Monitoring

监控

bash
npx ruv-swarm actions analytics [options]
  --workflow <name>       Workflow to analyze
  --period <duration>     Analysis period
  --identify-bottlenecks  Find bottlenecks
  --suggest-improvements  Improvement suggestions
</details>
bash
npx ruv-swarm actions analytics [options]
  --workflow <name>       Workflow to analyze
  --period <duration>     Analysis period
  --identify-bottlenecks  Find bottlenecks
  --suggest-improvements  Improvement suggestions
</details>

Integration Checklist

集成检查清单

✅ Setup Verification

✅ 配置验证

<details> <summary>Verify Your Setup</summary>
  • GitHub CLI (
    gh
    ) installed and authenticated
  • Git configured with user credentials
  • Node.js v16+ installed
  • claude-flow@alpha
    package available
  • Repository has
    .github/workflows
    directory
  • GitHub Actions enabled on repository
  • Necessary secrets configured
  • Runner permissions verified
<details> <summary>验证您的配置</summary>
  • GitHub CLI (
    gh
    )已安装并完成认证
  • Git已配置用户凭证
  • Node.js v16+已安装
  • claude-flow@alpha
    包可用
  • 仓库包含
    .github/workflows
    目录
  • 仓库已启用GitHub Actions
  • 已配置必要的密钥
  • 已验证Runner权限

Quick Setup Script

快速配置脚本

bash
#!/bin/bash
bash
#!/bin/bash

setup-github-automation.sh

setup-github-automation.sh

Install dependencies

Install dependencies

npm install -g claude-flow@alpha
npm install -g claude-flow@alpha

Verify GitHub CLI

Verify GitHub CLI

gh auth status || gh auth login
gh auth status || gh auth login

Create workflow directory

Create workflow directory

mkdir -p .github/workflows
mkdir -p .github/workflows

Generate initial workflow

Generate initial workflow

npx ruv-swarm actions generate-workflow
--analyze-codebase
--create-optimal-pipeline > .github/workflows/ci.yml
echo "✅ GitHub workflow automation setup complete"

</details>
npx ruv-swarm actions generate-workflow
--analyze-codebase
--create-optimal-pipeline > .github/workflows/ci.yml
echo "✅ GitHub workflow automation setup complete"

</details>

Related Skills

相关技能

  • github-pr-enhancement
    - Advanced PR management
  • release-coordination
    - Release automation
  • swarm-coordination
    - Multi-agent orchestration
  • ci-cd-optimization
    - Pipeline optimization
  • github-pr-enhancement
    - 高级PR管理
  • release-coordination
    - 发布自动化
  • swarm-coordination
    - 多代理编排
  • ci-cd-optimization
    - 流水线优化

Support & Documentation

支持与文档

Version History

版本历史

  • v1.0.0 (2025-01-19): Initial skill consolidation
    • Merged workflow-automation.md (441 lines)
    • Merged github-modes.md (146 lines)
    • Added progressive disclosure
    • Enhanced with swarm coordination patterns
    • Added comprehensive examples and best practices

Skill Status: ✅ Production Ready Last Updated: 2025-01-19 Maintainer: claude-flow team
  • v1.0.0 (2025-01-19):初始技能整合
    • 合并workflow-automation.md(441行)
    • 合并github-modes.md(146行)
    • 添加渐进式披露
    • 增强集群协作模式
    • 添加全面示例与最佳实践

技能状态:✅ 生产可用 最后更新:2025-01-19 维护者:claude-flow团队