Skip to content

Commit 24b55e2

Browse files
nkoji21claude
andcommitted
feat(ci): セキュリティチェックとpinact自動修正を追加
- gitleaks: シークレット検出 - zizmor: GitHub Actions脆弱性スキャン - actionlint: ワークフロー構文チェック - pinact: アクションSHA自動固定 - GitHub App bot経由でpinactが自動修正 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent eb5039c commit 24b55e2

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'Setup Git Bot'
2+
description: 'Configure git with bot identity for automated commits'
3+
4+
inputs:
5+
app-id:
6+
description: 'GitHub App ID'
7+
required: true
8+
private-key:
9+
description: 'GitHub App private key'
10+
required: true
11+
12+
outputs:
13+
token:
14+
description: 'GitHub App token for subsequent steps'
15+
value: ${{ steps.app-token.outputs.token }}
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Generate GitHub App Token
21+
id: app-token
22+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
23+
with:
24+
app-id: ${{ inputs.app-id }}
25+
private-key: ${{ inputs.private-key }}
26+
27+
- name: Configure git bot identity
28+
shell: bash
29+
env:
30+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
31+
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
32+
run: |
33+
bot_id=$(gh api "users/${APP_SLUG}[bot]" --jq '.id')
34+
git config user.name "${APP_SLUG}[bot]"
35+
git config user.email "${bot_id}+${APP_SLUG}[bot]@users.noreply.github.com"

.github/workflows/ci.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
security:
14+
name: Security Checks
15+
runs-on: ubuntu-slim
16+
permissions:
17+
contents: read
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Run Gitleaks
25+
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Run Zizmor
30+
uses: zizmorcore/zizmor@a5e304f536f1ba836aba0b966eb459f99f1658c1 # v1.19.0
31+
with:
32+
input: .github/workflows/
33+
34+
actions-quality:
35+
name: Actions Quality Checks
36+
runs-on: ubuntu-slim
37+
permissions:
38+
contents: write
39+
pull-requests: write
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Setup Git Bot
47+
id: bot
48+
uses: ./.github/actions/setup-git-bot
49+
with:
50+
app-id: ${{ secrets.BOT_APP_ID }}
51+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
52+
53+
- name: Run actionlint
54+
uses: reviewdog/action-actionlint@0b89ab5ea641e80701bca20b11cb99b7fdf8c1ea # v1.59.0
55+
with:
56+
github_token: ${{ steps.bot.outputs.token }}
57+
58+
- name: Setup aqua
59+
uses: aquaproj/aqua-installer@6ce1f8848ec8e61f14d57bd5d7597057a6dd187c # v3.0.1
60+
with:
61+
aqua_version: v2.40.3
62+
63+
- name: Install pinact
64+
run: aqua g -i suzuki-shunsuke/pinact
65+
66+
- name: Run pinact and auto-fix
67+
env:
68+
GH_TOKEN: ${{ steps.bot.outputs.token }}
69+
run: |
70+
pinact run .github/workflows/
71+
if git diff --quiet; then
72+
echo "No changes needed"
73+
exit 0
74+
fi
75+
76+
git add .github/workflows/
77+
git commit -m "chore(ci): pin GitHub Actions to commit SHA"
78+
git push

0 commit comments

Comments
 (0)