Back to Skills

gha-sha-reference

verified

ユーザーがGitHub Actionsのタグ参照をSHA参照に変換するよう要求したときに発動してください。uses:フィールドのタグ参照を自動的にSHA参照(コミットハッシュ + コメント付きバージョン)に変換します。

View on GitHub

Marketplace

syou6162-marketplace

syou6162/claude-code-commands

Plugin

syou6162-plugin

Repository

syou6162/claude-code-commands
10stars

skills/gha-sha-reference/SKILL.md

Last Verified

January 22, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/syou6162/claude-code-commands/blob/main/skills/gha-sha-reference/SKILL.md -a claude-code --skill gha-sha-reference

Installation paths:

Claude
.claude/skills/gha-sha-reference/
Powered by add-skill CLI

Instructions

# GitHub Actions SHA Reference Skill

## 目的

このスキルはGitHub Actionsワークフローファイル内の`uses:`フィールドで使用されているタグ参照(例: `@v4`)を、セキュリティのベストプラクティスに従ってSHA参照(例: `@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2`)に自動変換します。

## 使用タイミング

<trigger>

以下の場合にこのスキルを発動してください:

- ユーザーが「GitHub ActionsをSHA参照に変換して」と要求したとき
- ユーザーが「actionsのusesをSHAに書き換えて」と言及したとき

</trigger>

## 実行手順

<procedure>

### 1. 変更対象を確認

まず `--check --diff` オプションで、どのファイルが変更されるかを確認します:

```bash
pinact run --check --diff
```

**出力例**:

```
ERROR action isn't pinned
.github/workflows/ci.yaml:10
-       uses: actions/checkout@v4
+       uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
ERROR action isn't pinned
.github/workflows/ci.yaml:11
-     - uses: actions/setup-go@v4
+     - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
ERROR action isn't pinned
.github/workflows/deploy.yaml:15
-       uses: actions/checkout@v4
+       uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
```

### 2. 変換を実行

確認後、`pinact run` を実行してすべての対象ファイルを一括変換します:

```bash
pinact run
```

pinactは以下を自動的に行います:
- タグ参照からコミットSHAを取得
- 最も詳細なバージョンタグ(v4.3.0など)をコメントとして追加
- `.github/workflows/*.{yml,yaml}` と `action.{yml,yaml}` を自動検出して変換

</procedure>

## 実装例

<examples>

### 例1: 基本的な使用方法

<example>

**ステップ1: 変更対象を確認**:

```bash
pinact run --check --diff
```

**出力**:

```
ERROR action isn't pinned
.github/workflows/ci.yaml:10
-       uses: actions/checkout@v4
+       uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
ERROR action isn't pinned
.github/workflows/ci.yaml:11
-     - uses: actions/setup-go@v4
+     - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
```

**ステップ2: 変換を実行**:

```bash
pinact run
```

**変換後のワークフローファイル (.github/workflows/ci.yaml)**:

```yaml
name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
      - uses: actions/setup-go@4d34df

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
2750 chars