agentleFS
fideguchfideguch/my_pm_tools/skills/ci-cd-pipeline/SKILL.md

ci-cd-pipeline

Skill1 starsChanged 8 months agoMITView on GitHub

GitHub Actions を使った品質パイプラインを構築するスキル。 PR 作成・更新時に lint → typecheck → test → build の品質ゲートを自動実行し、 マージ品質を担保する。

  • Reads credentials
  • Installs packages

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use performance-review and api-design.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    performance-review

    Structure a performance review with self-assessment, manager template, and calibration prep. Use when review season kicks off and you need a self-assessment template, writing a manager review for a direct report, prepping rating distributions and promotion cases for calibration, or turning vague feedback into specific behavioral examples.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

Files
SKILL.md

GitHub Actions CI/CD 品質パイプライン構築スキル

メタデータ

  • トリガー: 「CI/CDを設定したい」「GitHub Actions パイプライン」「品質チェック自動化」「CI設定」
  • 前提条件: GitHub リポジトリ、package.json または pyproject.toml が存在

概要

GitHub Actions を使った品質パイプラインを構築するスキル。 PR 作成・更新時に lint → typecheck → test → build の品質ゲートを自動実行し、 マージ品質を担保する。


Phase 1: プロジェクト分析

1.1 技術スタック検出

# パッケージマネージャー判定
[ -f pnpm-lock.yaml ] && echo "pnpm" || \
[ -f yarn.lock ] && echo "yarn" || \
[ -f bun.lockb ] && echo "bun" || \
echo "npm"

# ランタイム判定
[ -f package.json ] && echo "Node.js"
[ -f pyproject.toml ] && echo "Python"
[ -f go.mod ] && echo "Go"
[ -f Cargo.toml ] && echo "Rust"

# Node.js バージョン確認
[ -f .nvmrc ] && cat .nvmrc
[ -f .node-version ] && cat .node-version
node -v 2>/dev/null

1.2 既存スクリプト確認

# package.json のスクリプト一覧
node -e "const p=require('./package.json'); console.log(Object.keys(p.scripts||{}).join('\n'))"

1.3 既存ワークフロー確認

ls -la .github/workflows/ 2>/dev/null

Phase 2: CI ワークフロー生成

2.1 基本品質チェック(.github/workflows/ci.yml)

name: CI Quality Check

on:
  pull_request:
    branches: [main, develop]
  push:
    branches: [main]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  quality:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install dependencies
        run: |
          if [ -f package-lock.json ]; then
            npm ci
          else
            npm install
          fi

      - name: Lint
        run: npm run lint --if-present

      - name: Type Check
        run: npm run typecheck --if-present

      - name: Format Check
        run: npm run format:check --if-present

      - name: Unit Tests
        run: |
          TEST_SCRIPT=$(node -e "const p=require('./package.json'); console.log(p.scripts?.test || '')")
          if [ -n "$TEST_SCRIPT" ] && [ "$TEST_SCRIPT" != "echo \"Error: no test specified\" && exit 1" ]; then
            npm test -- --coverage --passWithNoTests
          else
            echo "No test script configured, skipping"
          fi

      - name: Build
        run: npm run build --if-present

2.2 PR 自動ラベル付与(.github/workflows/pr-labeler.yml)

name: PR Labeler

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  label:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/labeler@v5
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}

2.3 ラベル設定ファイル(.github/labeler.yml)

frontend:
  - changed-files:
      - any-glob-to-any-file:
          - 'src/components/**'
          - 'src/pages/**'
          - 'src/styles/**'
          - '*.css'
          - '*.scss'

backend:
  - changed-files:
      - any-glob-to-any-file:
          - 'src/api/**'
          - 'src/server/**'
          - 'src/services/**'

infra:
  - changed-files:
      - any-glob-to-any-file:
          - '.github/**'
          - 'Dockerfile'
          - 'docker-compose*.yml'
          - '*.yml'

docs:
  - changed-files:
      - any-glob-to-any-file:
          - '**/*.md'
          - 'docs/**'

2.4 Project 自動化(.github/workflows/project-automation.yml)

name: Project Automation

on:
  pull_request:
    types: [opened, closed]
  pull_request_review:
    types: [submitted]
  issues:
    types: [opened, closed, reopened]

jobs:
  update-project:
    runs-on: ubuntu-latest
    if: ${{ secrets.PROJECT_TOKEN != '' }}
    steps:
      - name: Update project status
        uses: actions/github-script@v7
        with:
          github-token: ${{ secrets.PROJECT_TOKEN }}
          script: |
            const event = context.eventName;
            const action = context.payload.action;

            console.log(`Event: ${event}, Action: ${action}`);

            // Issue/PR 作成時 → 進行待ち
            if (action === 'opened') {
              console.log('New item opened - should be set to 進行待ち');
            }

            // PR マージ時 → Done
            if (event === 'pull_request' && action === 'closed' && context.payload.pull_request.merged) {
              console.log('PR merged - should be set to Done');
            }

            // レビュー承認時 → テスト中
            if (event === 'pull_request_review' && context.payload.review.state === 'approved') {
              console.log('Review approved - should be set to テスト中');
            }

            // Issue クローズ時 → Done
            if (event === 'issues' && action === 'closed') {
              console.log('Issue closed - should be set to Done');
            }

            // Issue 再オープン時 → 進行待ち
            if (event === 'issues' && action === 'reopened') {
              console.log('Issue reopened - should be set to 進行待ち');
            }

2.5 滞留タスク検知(.github/workflows/stale-detection.yml)

name: Stale Issue Detection

on:
  schedule:
    - cron: '0 0 * * 1' # 毎週月曜 00:00 UTC

jobs:
  detect-stale:
    runs-on: ubuntu-latest
    steps:
      - name: Check stale items
        uses: actions/github-script@v7
        with:
          script: |
            const fiveDaysAgo = new Date(Date.now() - 5 * 24 * 60 * 60 * 1000);

            const issues = await github.rest.issues.listForRepo({
              owner: context.repo.owner,
              repo: context.repo.repo,
              state: 'open',
              sort: 'updated',
              direction: 'asc',
              per_page: 100,
            });

            const staleIssues = issues.data.filter(
              (issue) => new Date(issue.updated_at) < fiveDaysAgo
            );

            if (staleIssues.length > 0) {
              console.log(`Found ${staleIssues.length} stale issues:`);
              for (const issue of staleIssues) {
                const days = Math.floor(
                  (Date.now() - new Date(issue.updated_at)) / (1000 * 60 * 60 * 24)
                );
                console.log(`  #${issue.number}: ${issue.title} (${days} days stale)`);
              }
            } else {
              console.log('No stale issues found.');
            }

Phase 3: ブランチ保護ルール

ユーザーに以下のブランチ保護設定を推奨:

設定推奨値
Require status checksCI Quality Check
Require PR reviews1名以上
Dismiss stale reviews有効
Require up-to-date branch有効
Restrict force pushes有効

Phase 4: 動作確認

# ローカルで CI と同じコマンドを実行
npm run lint --if-present
npm run typecheck --if-present
npm run format:check --if-present
npm test --if-present
npm run build --if-present

完了チェックリスト

#確認項目状態
1.github/workflows/ci.yml が存在する
2.github/workflows/pr-labeler.yml が存在する
3.github/labeler.yml が存在する
4.github/workflows/project-automation.yml が存在する
5.github/workflows/stale-detection.yml が存在する
6CI が PR で正常に動作する
7ブランチ保護ルールが設定されている

パッケージマネージャー別の調整

マネージャーインストールキャッシュ設定
npmnpm cicache: 'npm'
pnpmpnpm install --frozen-lockfilepnpm/action-setup@v4 + cache: 'pnpm'
yarnyarn install --frozen-lockfilecache: 'yarn'
bunbun install --frozen-lockfileoven-sh/setup-bun@v2

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.