文件历史

4 次代码提交

作者 SHA1 备注 提交日期
Seth Hobson f31aba246e Skip Claude review on fork PRs (#559)
Fork PRs don't have access to secrets or OIDC tokens, causing
claude-code-action to fail on OIDC authentication. Skip the job
entirely for cross-repository PRs so CI stays green.
2026-05-25 20:26:53 -04:00
Seth Hobson 1385ee046d Add Claude Code GitHub Workflow (#544)
* "Claude PR Assistant workflow"

* "Claude Code Review workflow"

* ci: tune Claude Code workflows for marketplace review

- Auto-review (claude-code-review.yml): replace generic
  /code-review:code-review slash command with a multi-line prompt that
  carries the repo's invariants (source-of-truth under plugins/, no __
  in plugin names, Codex 8 KB skill cap, AGENTS.md/CLAUDE.md/GEMINI.md
  sync, quality gates). Bump model to claude-opus-4-7. Grant
  pull-requests: write so inline comments and PR summaries can post.
  Add track_progress: true. Skip drafts and dependabot.
- @claude responder (claude.yml): bump model to claude-opus-4-7. Grant
  write scopes for contents/pull-requests/issues so @claude can
  actually fix things. Gate on author_association so only OWNER /
  MEMBER / COLLABORATOR can trigger writes (closes a real auth gap
  flagged by coderabbit, critical now that scopes are write). Curate
  --allowedTools for this repo's uv + ruff + ty + pytest + make + gh +
  git toolchain.
- Both: pin actions/checkout to SHA with persist-credentials: false to
  match .github/workflows/validate.yml convention.

Inspired by major7apps/pensyve and major7apps/maverick-bot review
workflows.

* ci: address coderabbit review on claude workflows

- Pin anthropics/claude-code-action to v1 commit SHA
  (4481e6d3c7bbb88db2a928ca3444c536f589c7c1) — satisfies zizmor's
  blanket-pin policy.
- Drop the implicit "approve with a one-line summary" instruction from
  the review prompt; the workflow's allowedTools only expose inline
  comments and gh pr comment, not a review-submission API. Replace
  with an explicit "post a one-line  summary via gh pr comment and
  stop" so the success path is actually executable.
- Swap issues.types from [opened, assigned] to [opened, edited] on
  claude.yml. The if:-condition only checks issue.body/title for
  @claude, so reassignment-firing produces false triggers while edits
  to existing issues currently fire nothing.

Skipped (with reason): "checkout PR head ref" finding. Anthropic's
canonical claude.yml template (anthropics/claude-code-action examples)
does not set with.ref — the action resolves the PR head internally
via the GitHub API. Forcing a specific ref would diverge from the
upstream contract.

* ci: enumerate git subcommands in @claude allowedTools

Replace the `Bash(git:*)` wildcard with an explicit list of safe
subcommands (status/diff/log/show/rev-parse/branch/tag/ls-files for
inspection; add/commit/checkout/switch/fetch/pull/push/stash for
workflow). Destructive ops like `reset`, `clean`, `rebase`,
`filter-branch`, and `branch -D` are no longer callable — they are
absent from the enumeration.

Addresses coderabbit finding: the wildcard conflicted with the repo's
own security checklist ("no destructive git in scripts") embedded in
claude-code-review.yml.

* ci: further tighten @claude allowedTools to read-only git + scoped gh

Drop `Bash(gh:*)` wildcard and the write-side `git` subcommands.

- `gh` is now enumerated: pr view/diff/list/comment/edit/checks,
  issue view/list/comment/edit, api, run view, workflow view, search.
- `git` is now read-only: status, diff, log, show, rev-parse, ls-files.
  Removed `branch`, `tag`, `add`, `commit`, `checkout`, `switch`,
  `fetch`, `pull`, `push`, `stash` — `git branch -D`, `git tag -d`,
  `git checkout -- .`, `git push --force`, etc. are no longer reachable.

Commits and branch creation are handled by anthropics/claude-code-action
internally via the GitHub API (`branch_prefix` / `branch_name_template`
action inputs), so local write-side git is not required for @claude to
fix things — `Edit`/`Write` produce the changes; the action commits.

Addresses coderabbit follow-up: --allowedTools doesn't understand
destructive flags, so safety comes from precise command patterns.

* ci: scope @claude gh api allowlist to specific endpoints

Drop `Bash(gh api:*)` (which exposed the entire GitHub REST API
surface, including DELETE/PATCH endpoints) in favor of three scoped
patterns sufficient for reading discussion context:

- repos/*/pulls/*/comments  — PR review-thread reads
- repos/*/issues/*/comments — issue-thread reads
- repos/*/issues/*/timeline — issue history

Mirrors the same scoping style used in claude-code-review.yml. The
enumerated `gh pr` / `gh issue` / `gh run` / `gh workflow` / `gh search`
subcommands cover the rest of the responder's typical needs.

Addresses coderabbit finding.
2026-05-22 14:55:49 -04:00
Seth Hobson f95810b340 chore: remove Claude Code GitHub workflows
The workflows were failing for fork PRs due to GitHub security
restrictions on secrets access. Removing until a better solution
is implemented.
2025-12-30 16:25:52 -05:00
Seth Hobson 27a246a8c6 Add Claude Code GitHub Workflow (#140)
* "Claude PR Assistant workflow"

* "Claude Code Review workflow"
2025-12-10 15:12:53 -05:00