Skip to content
This repository was archived by the owner on Sep 28, 2026. It is now read-only.

Harden Claude workflow triggers - #3

Merged
myon-bioinformatics merged 2 commits into
mainfrom
fix/claude-workflow-guardrails
Aug 13, 2026
Merged

myon-bioinformatics merged 2 commits into
mainfrom
fix/claude-workflow-guardrails

Conversation

@myon-bioinformatics

Copy link
Copy Markdown
Owner

Summary

Harden the Claude GitHub Action and prevent unrelated legacy workflows from blocking actionlint.

Changes

  • Restrict @claude events to OWNER, MEMBER, or COLLABORATOR
  • Keep manual workflow_dispatch available to users authorized to run workflows
  • Scope actionlint to the two automation workflows added by this rollout

Validation

  • actionlint runs on this PR
  • A review-only @claude audit will be requested after the check succeeds

Copy link
Copy Markdown
Owner Author

@claude
このPRを監査してください。@claude 起動者の権限ゲートとactionlint対象範囲が意図通りか、YAML構文・GitHub Actions式・既存の手動実行機能への影響を確認してください。監査のみで、ファイル編集・コミット・PR作成はしないでください。

@claude

claude Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Claude finished @myon-bioinformatics's task in 1m 55s —— View job


Claude finished the audit

Task list

  • Gather context (read changed workflow files, diff vs origin/main)
  • Verify @claude trigger permission gate (OWNER/MEMBER/COLLABORATOR) is correctly implemented
  • Verify workflow_dispatch manual trigger still works for authorized users
  • Verify actionlint scope change only targets the two new automation workflows
  • Check YAML syntax and GitHub Actions expression syntax
  • Check CI status
  • Post final audit findings

This was a review-only audit per the trigger request — no files were edited, no commits made, no PR opened.


1. @claude 起動者の権限ゲート — 意図通り

.github/workflows/claude.yml:33-47 の各イベント分岐 (issue_comment / pull_request_review_comment / pull_request_review / issues) すべてに contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), <...>.author_association) が追加されています。

  • 各イベント分岐は既存の (...) で個別にグループ化されており、追加した && はその括弧内に収まっているため、|| との優先順位問題は発生しません(元々の構造を維持したまま条件を追加した安全な変更です)。
  • author_association は各分岐で「起動者」(コメント/レビュー/Issue の author)のものを参照しており、意図通り "誰が @claude を呼んだか" をゲートしています。PR 作成者ではなく起動者ベースなのが正しいポイントです。
  • fromJSON の値は GitHub が実際に返す author_association の大文字表記 (OWNER, MEMBER, COLLABORATOR) と一致しています。

軽微な注意点(バグではなく既存ロジックの特性): issues イベントは types: [opened, assigned] を含みます (claude.yml:24-25)。assigned イベントでも author_association は Issue 作成者 のものが使われるため、「非コラボレーターが本文に @claude を含む Issue を作成 → 後でメンテナが assign」というケースでは、assign した人の権限に関わらずゲートされたままになります。今回のPRで導入されたロジックではなく、既存の body/title チェックに新しい権限ゲートを重ねた結果として顕在化する特性なので、意図通りであれば対応不要です。

2. workflow_dispatch(既存の手動実行機能)— 影響なし

if: の最初の条件 github.event_name == 'workflow_dispatch' は権限ゲートを追加せずそのまま残っています。workflow_dispatch は GitHub 側で書き込み権限を持つユーザーのみ手動実行できるため、追加のゲートは不要という設計判断は妥当です。ステップ側の if: github.event_name == 'workflow_dispatch' / != 'workflow_dispatch' 分岐 (claude.yml:64-75) も変更されておらず、prompt input を使った手動実行フローは影響を受けません。

3. actionlint 対象範囲 — 意図通り、軽微な運用上の注意点あり

.github/workflows/actionlint.yml:19-22 で args: -color .github/workflows/claude.yml .github/workflows/actionlint.yml を明示指定し、対象を今回追加した2ワークフローに限定しています。PR説明どおり「既存レガシーワークフローの構文エラーで actionlint がブロックされる」問題を回避できます。

  • ただし on: トリガー自体 (pull_request/push の paths: .github/workflows/**) は変更されていないため、このジョブは どのワークフローファイルの変更でも起動 しますが、常にこの2ファイルしか検証しません。将来3つ目の自動化ワークフローを追加した場合は args に追記が必要になる点は運用上の注意点として留意してください(バグではありません)。

4. YAML構文 / GitHub Actions式構文

目視レビューおよびCI実行結果の両方で問題なし:

  • if: | のブロックスカラー、括弧によるグルーピング、fromJSON(...) + contains(...) の式はいずれも文法的に正しい。
  • CI上の Validate GitHub Actions (actionlint) ジョブは本PRのHEADで 成功しています(run)。

結論

権限ゲートとactionlintスコープの変更はいずれもPRの意図通りに実装されており、workflow_dispatch を含む既存の手動実行機能への悪影響も見当たりません。上記の2点(issues/assigned の author_association の由来、将来ワークフロー追加時の args 更新要否)は運用上の留意点として共有しますが、マージをブロックする問題ではありません。
· Branch: fix/claude-workflow-guardrails

@myon-bioinformatics
myon-bioinformatics merged commit f081f62 into main Aug 13, 2026
7 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant