mcpField
G
github-actions-2025

github-actions-2025

github.com/josiahsiegelクラウド・DevOps59162 回インストール19 週間前に更新
リポジトリ

github-actions-2025 について

GitHub Actions のワークフローを保守するチーム向けに、2025 年のランナー、リリース、ランタイム、セキュリティ、アーティファクトの変更をまとめています。自動化や CI/CD 設定の移行例も掲載しています。

主な機能

  1. 011 vCPU ランナーの利用ガイド
  2. 02イミュータブルリリースの実践
  3. 03Node24 への移行手順
  4. 04環境保護ルール
  5. 05アクションの制限と SHA 固定
  6. 06アーティファクトアクションの移行

活用シーン

  1. 01軽量な自動化に使うランナーの選定
  2. 02本番リリースのイミュータブル化
  3. 03カスタムアクションの Node24 対応
  4. 04ワークフローアクションの制限と固定

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill github-actions-2025

インストール後、Claude Code で/github-actions-2025を入力して読み込まれたか確認します。

詳細

GitHub Actions 2025年の機能

1 vCPU Linux ランナー(2025年10月 - パブリックプレビュー)

概要: 自動化タスク向けに最適化され、コストを抑えられる新しい軽量ランナーです。

仕様:

  • 1 vCPU
  • 5 GB RAM
  • ジョブの制限時間は15分
  • 短時間で完了するタスク向けに最適化
1 vCPU ランナーを使用する場面

最適な用途:

  • イシューのトリアージ自動化
  • ラベル管理
  • PR コメントの自動化
  • ステータスチェック
  • 軽量なスクリプト
  • Git 操作(チェックアウト、タグ付け、コミット)
  • 通知タスク

適さない用途:

  • ビルド操作
  • テストスイート
  • 複雑な CI/CD パイプライン
  • リソースを大量に消費する操作
使用方法
# .github/workflows/automation.yml
name: Lightweight Automation

on:
  issues:
    types: [opened, labeled]

jobs:
  triage:
    runs-on: ubuntu-latest-1-core  # New 1 vCPU runner
    timeout-minutes: 10  # Max 15 minutes
    steps:
      - name: Triage Issue
        run: |
          echo "Triaging issue..."
          gh issue edit ${{ github.event.issue.number }} --add-label "needs-review"
コスト削減の例
# Before: Using 2 vCPU runner for simple task
jobs:
  label:
    runs-on: ubuntu-latest  # 2 vCPU, higher cost
    steps:
      - name: Add label
        run: gh pr edit ${{ github.event.number }} --add-label "reviewed"

# After: Using 1 vCPU runner (lower cost)
jobs:
  label:
    runs-on: ubuntu-latest-1-core  # 1 vCPU, 50% cost reduction
    timeout-minutes: 5
    steps:
      - name: Add label
        run: gh pr edit ${{ github.event.number }} --add-label "reviewed"

イミュータブルリリース(2025年8月)

概要: リリースをイミュータブルとして設定できるようになりました。一度リリースすると、アセットや Git タグを変更または削除できません。

メリット:

  • サプライチェーンセキュリティ
  • 監査コンプライアンス
  • 改ざんの防止
  • リリース成果物への信頼
イミュータブルリリースの作成
# Using GitHub CLI
gh release create v1.0.0 \
  dist/*.zip \
  --title "Version 1.0.0" \
  --notes-file CHANGELOG.md \
  --immutable

# Verify immutability
gh release view v1.0.0 --json isImmutable
GitHub Actions ワークフロー
# .github/workflows/release.yml
name: Create Immutable Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build artifacts
        run: npm run build

      - name: Create Immutable Release
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const tag = context.ref.replace('refs/tags/', '');

            await github.rest.repos.createRelease({
              owner: context.repo.owner,
              repo: context.repo.repo,
              tag_name: tag,
              name: `Release ${tag}`,
              body: fs.readFileSync('CHANGELOG.md', 'utf8'),
              draft: false,
              prerelease: false,
              make_immutable: true  # Mark as immutable
            });

      - name: Upload Release Assets
        run: gh release upload ${{ github.ref_name }} dist/*.zip --clobber
イミュータブルリリースのポリシー
# Organizational policy for immutable releases
name: Enforce Immutable Releases

on:
  release:
    types: [created]

jobs:
  enforce-immutability:
    runs-on: ubuntu-latest
    if: "!github.event.release.immutable && startsWith(github.event.release.tag_name, 'v')"

    steps:
      - name: Fail if not immutable
        run: |
          echo "ERROR: Production releases must be immutable"
          exit 1

Node24 への移行(2025年9月)

概要: GitHub Actions は2025年秋に Node20 から Node24 へ移行します。

スケジュール:

  • 2025年9月:Node24 のサポートを追加
  • 2025年10月:Node20 の非推奨に関する通知
  • 2025年11月:Node20 の段階的な廃止を開始
  • 2025年12月:Node24 への完全移行
アクションを更新する

アクション内の Node バージョンを確認します:

# Old - Node20
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v3
        with:
          node-version: '20'  # Update to 24

# New - Node24
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: '24'  # Current LTS
ランナーバージョンの互換性
# Ensure runner supports Node24
jobs:
  test:
    runs-on: ubuntu-latest  # Runner v2.328.0+ supports Node24

    steps:
      - name: Verify Node version
        run: node --version  # Should show v24.x.x
カスタムアクションの移行

カスタムアクションを管理している場合:

// action.yml
runs:
  using: 'node24'  // Updated from 'node20'
  main: 'index.js'
# Update dependencies
npm install @actions/core@latest
npm install @actions/github@latest

# Test with Node24
node --version  # Ensure 24.x
npm test

Actions 環境変数(2025年5月)

概要: すべてのプランで Actions 環境を利用できるようになりました(パブリックリポジトリとプライベートリポジトリ)。

環境の保護ルール
# .github/workflows/deploy.yml
name: Deploy to Production

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://app.example.com

    steps:
      - name: Deploy
        run: |
          echo "Deploying to ${{ vars.DEPLOY_URL }}"
          # Deployment steps...

環境の設定:

  • Settings → Environments → production
  • 保護ルールを追加:
    • 必須のレビュアー
    • 待機タイマー
    • デプロイ先ブランチ(main のみ)

許可されたアクションのポリシー更新(2025年8月)

概要: 明示的なブロックと SHA ピン留めによるガバナンスの強化です。

特定のアクションをブロックする
# .github/workflows/policy.yml
# Repository or organization settings
allowed-actions:
  verified-only: true

  # Explicitly block actions
  blocked-actions:
    - 'untrusted/action@*'
    - 'deprecated-org/*'

  # Require SHA pinning for security
  require-sha-pinning: true
セキュリティのための SHA ピン留め
# Before: Version pinning (can be changed by action maintainer)
- uses: actions/checkout@v4

# After: SHA pinning (immutable)
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11  # v4.1.1
SHA ピン留めされたアクションを生成する
# Get commit SHA for specific version
gh api repos/actions/checkout/commits/v4.1.1 --jq '.sha'

# Or use action-security tool
npx pin-github-action actions/checkout@v4
# Output: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

Copilot がトリガーするワークフロー(2025年4月)

概要: Copilot が作成したイベントによってトリガーされるワークフローでは、明示的な承認が必要になりました。

Copilot ワークフローの承認を設定する
# .github/workflows/copilot-automation.yml
name: Copilot PR Automation

on:
  pull_request:
    types: [opened]

jobs:
  copilot-review:
    runs-on: ubuntu-latest

    # Copilot-generated PRs require approval
    if: github.event.pull_request.user.login != 'github-copilot[bot]'

    steps:
      - name: Auto-review
        run: gh pr review --approve

Copilot の PR には手動承認が必要です(フォーク PR と同じ仕組みです)。

アーティファクトストレージのアーキテクチャ(2025年2月)

概要: 2025年2月1日に、アーティファクトは新しいアーキテクチャに移行しました。

互換性を破る変更:

  • actions/upload-artifact@v1-v2 は2025年3月1日に廃止
  • actions/upload-artifact@v4+ を使用する必要があります
移行
# Old (Retired)
- uses: actions/upload-artifact@v2
  with:
    name: build-artifacts
    path: dist/

# New (Required)
- uses: actions/upload-artifact@v4
  with:
    name: build-artifacts
    path: dist/
    retention-days: 30

Windows Server 2019 の廃止(2025年6月)

概要: windows-2019 ランナーイメージは2025年6月30日に完全に廃止されました。

移行
# Old
jobs:
  build:
    runs-on: windows-2019  # Retired

# New
jobs:
  build:
    runs-on: windows-2022  # Current
    # Or windows-latest (recommended)

セルフホストランナー向け Meta API(2025年5月)

概要: ネットワーク設定向けの新しい actions_inbound セクションが Meta API に追加されました。

# Get network requirements for self-hosted runners
curl https://api.github.com/meta | jq '.actions_inbound'

# Configure firewall rules based on response
{
  "domains": [
    "*.actions.githubusercontent.com",
    "*.pkg.github.com"
  ],
  "ip_ranges": [
    "140.82.112.0/20",
    "143.55.64.0/20"
  ]
}

2025年のベストプラクティス

1. 適切なランナーを使用する
# Use 1 vCPU for lightweight tasks
jobs:
  label-management:
    runs-on: ubuntu-latest-1-core
    timeout-minutes: 5

  # Use standard runners for builds/tests
  build:
    runs-on: ubuntu-latest
2. 本番環境でイミュータブルリリースを使用する
# Always mark production releases as immutable
- name: Create Release
  run: gh release create $TAG --immutable
3. セキュリティのために SHA ピン留めを使用する
# Pin actions to SHA, not tags
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
4. Node24 に更新する
# Use latest Node version
- uses: actions/setup-node@v4
  with:
    node-version: '24'
5. 環境を保護する
# Use environments for deployments
jobs:
  deploy:
    environment: production
    # Requires approval, wait timer, branch restrictions

トラブルシューティング

1 vCPU ランナーのタイムアウト:

# Ensure task completes within 15 minutes
jobs:
  task:
    runs-on: ubuntu-latest-1-core
    timeout-minutes: 10  # Safety margin

Node24 の互換性に関する問題:

# Test locally with Node24
nvm install 24
nvm use 24
npm test

アーティファクトのアップロード失敗:

# Use v4 of artifact actions
- uses: actions/upload-artifact@v4  # Not v1/v2

リソース

コメント