jpskill.com
💬 コミュニケーション コミュニティ

github-actions

GitHub Actionsは、ワークフロー、マトリックスビルド、キャッシュ、シークレット管理、再利用可能なアクションを活用して、CI/CDパイプラインを構築・運用するためのSkillです。

📜 元の英語説明(参考)

GitHub Actions CI/CD mastery for workflows, matrix builds, caching, secrets, and reusable actions. Use when user asks to "set up CI", "create a workflow", "add GitHub Actions", "matrix builds", "cache dependencies", "deploy with actions", "reusable workflows", or any CI/CD pipeline tasks.

🇯🇵 日本人クリエイター向け解説

一言でいうと

GitHub Actionsは、ワークフロー、マトリックスビルド、キャッシュ、シークレット管理、再利用可能なアクションを活用して、CI/CDパイプラインを構築・運用するためのSkillです。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o github-actions.zip https://jpskill.com/download/6092.zip && unzip -o github-actions.zip && rm github-actions.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6092.zip -OutFile "$d\github-actions.zip"; Expand-Archive "$d\github-actions.zip" -DestinationPath $d -Force; ri "$d\github-actions.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して github-actions.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → github-actions フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

GitHub Actions

GitHub Actions を使用した CI/CD ワークフローです。

ワークフローの基本

# .github/workflows/ci.yml
name: CI

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

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test

トリガー

on:
  # ブランチイベント
  push:
    branches: [main, "release/**"]
    paths: ["src/**", "tests/**"]      # これらのパスが変更された場合のみ
    paths-ignore: ["docs/**", "*.md"]  # これらのパスは無視する

  pull_request:
    branches: [main]
    types: [opened, synchronize, reopened]

  # スケジュール
  schedule:
    - cron: "0 6 * * 1"  # 毎週月曜日 UTC 午前 6 時

  # 手動
  workflow_dispatch:
    inputs:
      environment:
        description: "デプロイターゲット"
        required: true
        default: "staging"
        type: choice
        options: [staging, production]

  # リリース時
  release:
    types: [published]

  # 別のワークフローから
  workflow_call:
    inputs:
      node-version:
        type: string
        default: "20"

マトリックスビルド

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [18, 20, 22]
        exclude:
          - os: macos-latest
            node: 18
        include:
          - os: ubuntu-latest
            node: 20
            coverage: true

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test
      - if: matrix.coverage
        run: npm run coverage

キャッシュ

# Node.js
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: "npm"

# Python
- uses: actions/setup-python@v5
  with:
    python-version: "3.12"
    cache: "pip"

# カスタムキャッシュ
- uses: actions/cache@v4
  with:
    path: |
      ~/.cache/pip
      .mypy_cache
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
    restore-keys: |
      ${{ runner.os }}-pip-

シークレットと環境変数

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production    # 保護ルールを持つ GitHub 環境
    env:
      NODE_ENV: production
    steps:
      - run: echo "Deploying..."
        env:
          API_KEY: ${{ secrets.API_KEY }}
          DATABASE_URL: ${{ secrets.DATABASE_URL }}

      # GITHUB_TOKEN (自動提供) の使用
      - run: gh pr comment --body "Deployed!"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

一般的なワークフローパターン

Node.js CI

name: Node CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm test
      - run: npm run build

Python CI

name: Python CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
          cache: pip
      - run: pip install -r requirements.txt
      - run: pytest --cov --cov-report=xml

Docker ビルドとプッシュ

name: Docker
on:
  push:
    tags: ["v*"]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}

環境へのデプロイ

name: Deploy
on:
  push:
    branches: [main]
jobs:
  staging:
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh staging

  production:
    needs: staging
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh production

ジョブの依存関係と出力

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.value }}
    steps:
      - id: version
        run: echo "value=$(cat VERSION)" >> $GITHUB_OUTPUT

  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: echo "Deploying ${{ needs.build.outputs.version }}"

条件式

steps:
  - if: github.event_name == 'push'
    run: echo "これはプッシュです"

  - if: github.ref == 'refs/heads/main'
    run: echo "main ブランチ上です"

  - if: contains(github.event.head_commit.message, '[skip ci]')
    run: echo "スキップしています"

  - if: success()   # 前のステップが成功した場合
    run: echo "すべて良好です"

  - if: failure()   # 前のステップが失敗した場合
    run: echo "何かが失敗しました"

  - if: always()    # 関係なく実行
    run: echo "クリーンアップ"

再利用可能なワークフロー

# .github/workflows/reusable-test.yml
on:
  workflow_call:
    inputs:
      node-version:
        type: string
        default: "20"
    secrets:
      npm-token:
        required: false

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ inputs.node-version }}
      - run: npm ci
      - run: npm test

# 呼び出し元ワークフロー
jobs:
  call-tests:
    uses: ./.github/workflows/reusable-test.yml
    with:
      node-version: "20"
    secrets: inherit

リファレンス

ワークフローテンプレートと人気のアクションについては、references/workflows.md および references/actions.md を参照してください。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

GitHub Actions

CI/CD workflows with GitHub Actions.

Workflow Basics

# .github/workflows/ci.yml
name: CI

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

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test

Triggers

on:
  # Branch events
  push:
    branches: [main, "release/**"]
    paths: ["src/**", "tests/**"]      # Only when these paths change
    paths-ignore: ["docs/**", "*.md"]  # Ignore these paths

  pull_request:
    branches: [main]
    types: [opened, synchronize, reopened]

  # Scheduled
  schedule:
    - cron: "0 6 * * 1"  # Every Monday at 6 AM UTC

  # Manual
  workflow_dispatch:
    inputs:
      environment:
        description: "Deploy target"
        required: true
        default: "staging"
        type: choice
        options: [staging, production]

  # On release
  release:
    types: [published]

  # From another workflow
  workflow_call:
    inputs:
      node-version:
        type: string
        default: "20"

Matrix Builds

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [18, 20, 22]
        exclude:
          - os: macos-latest
            node: 18
        include:
          - os: ubuntu-latest
            node: 20
            coverage: true

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test
      - if: matrix.coverage
        run: npm run coverage

Caching

# Node.js
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: "npm"

# Python
- uses: actions/setup-python@v5
  with:
    python-version: "3.12"
    cache: "pip"

# Custom cache
- uses: actions/cache@v4
  with:
    path: |
      ~/.cache/pip
      .mypy_cache
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
    restore-keys: |
      ${{ runner.os }}-pip-

Secrets & Environment Variables

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production    # GitHub environment with protection rules
    env:
      NODE_ENV: production
    steps:
      - run: echo "Deploying..."
        env:
          API_KEY: ${{ secrets.API_KEY }}
          DATABASE_URL: ${{ secrets.DATABASE_URL }}

      # Using GITHUB_TOKEN (auto-provided)
      - run: gh pr comment --body "Deployed!"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Common Workflow Patterns

Node.js CI

name: Node CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm test
      - run: npm run build

Python CI

name: Python CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
          cache: pip
      - run: pip install -r requirements.txt
      - run: pytest --cov --cov-report=xml

Docker Build & Push

name: Docker
on:
  push:
    tags: ["v*"]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}

Deploy to Environments

name: Deploy
on:
  push:
    branches: [main]
jobs:
  staging:
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh staging

  production:
    needs: staging
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - run: ./deploy.sh production

Job Dependencies & Outputs

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.value }}
    steps:
      - id: version
        run: echo "value=$(cat VERSION)" >> $GITHUB_OUTPUT

  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - run: echo "Deploying ${{ needs.build.outputs.version }}"

Conditionals

steps:
  - if: github.event_name == 'push'
    run: echo "This is a push"

  - if: github.ref == 'refs/heads/main'
    run: echo "On main branch"

  - if: contains(github.event.head_commit.message, '[skip ci]')
    run: echo "Skipping"

  - if: success()   # Previous steps succeeded
    run: echo "All good"

  - if: failure()   # Previous step failed
    run: echo "Something failed"

  - if: always()    # Run regardless
    run: echo "Cleanup"

Reusable Workflows

# .github/workflows/reusable-test.yml
on:
  workflow_call:
    inputs:
      node-version:
        type: string
        default: "20"
    secrets:
      npm-token:
        required: false

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ inputs.node-version }}
      - run: npm ci
      - run: npm test

# Caller workflow
jobs:
  call-tests:
    uses: ./.github/workflows/reusable-test.yml
    with:
      node-version: "20"
    secrets: inherit

Reference

For workflow templates and popular actions: references/workflows.md and references/actions.md