9201ef759e
CI / lint (push) Waiting to run
CI / mypy (push) Waiting to run
CI / docs (push) Waiting to run
CI / test on 3.10 (standard) (push) Waiting to run
CI / test on 3.11 (standard) (push) Waiting to run
CI / test on 3.12 (standard) (push) Waiting to run
CI / test on 3.10 (all-extras) (push) Waiting to run
CI / test on 3.11 (all-extras) (push) Waiting to run
CI / test on 3.12 (all-extras) (push) Waiting to run
CI / test on 3.13 (all-extras) (push) Waiting to run
CI / test on 3.14 (pydantic-evals) (push) Waiting to run
Harness Compat / harness compat (push) Waiting to run
CI / test on 3.13 (standard) (push) Waiting to run
CI / test on 3.14 (standard) (push) Waiting to run
CI / test on 3.14 (all-extras) (push) Waiting to run
CI / test on 3.10 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.11 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.12 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.13 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.14 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.10 (pydantic-evals) (push) Waiting to run
CI / test on 3.11 (pydantic-evals) (push) Waiting to run
CI / test on 3.12 (pydantic-evals) (push) Waiting to run
CI / test on 3.13 (pydantic-evals) (push) Waiting to run
CI / test on 3.10 (lowest-versions) (push) Waiting to run
CI / test on 3.11 (lowest-versions) (push) Waiting to run
CI / test on 3.12 (lowest-versions) (push) Waiting to run
CI / test on 3.13 (lowest-versions) (push) Waiting to run
CI / test on 3.14 (lowest-versions) (push) Waiting to run
CI / test examples on 3.11 (push) Waiting to run
CI / test examples on 3.12 (push) Waiting to run
CI / test examples on 3.13 (push) Waiting to run
CI / test examples on 3.14 (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / check (push) Blocked by required conditions
CI / deploy-docs (push) Blocked by required conditions
CI / deploy-docs-preview (push) Blocked by required conditions
CI / build release artifacts (push) Blocked by required conditions
CI / publish to PyPI (push) Blocked by required conditions
CI / Send tweet (push) Blocked by required conditions
148 lines
6.5 KiB
YAML
148 lines
6.5 KiB
YAML
name: '@claude'
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
issues:
|
|
types: [opened, assigned]
|
|
pull_request_review:
|
|
types: [submitted]
|
|
|
|
permissions: {}
|
|
|
|
env:
|
|
UV_PYTHON: 3.13
|
|
UV_FROZEN: "1"
|
|
|
|
jobs:
|
|
get-pr-info:
|
|
permissions:
|
|
contents: read
|
|
if: |
|
|
(
|
|
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
) && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'),
|
|
github.event.comment.author_association ||
|
|
github.event.review.author_association ||
|
|
github.event.issue.author_association)
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
is_fork: ${{ steps.pr-info.outputs.is_fork }}
|
|
pr_head_repo: ${{ steps.pr-info.outputs.pr_head_repo }}
|
|
pr_head_sha: ${{ steps.pr-info.outputs.pr_head_sha }}
|
|
pr_base_sha: ${{ steps.pr-info.outputs.pr_base_sha }}
|
|
steps:
|
|
- name: Get PR info
|
|
if: github.event.issue.pull_request || github.event.pull_request
|
|
id: pr-info
|
|
run: |
|
|
PR_NUMBER=${{ github.event.pull_request.number || github.event.issue.number }}
|
|
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${PR_NUMBER})
|
|
echo "pr_head_repo=$(echo "$PR_DATA" | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
|
|
echo "pr_head_sha=$(echo "$PR_DATA" | jq -r '.head.sha')" >> $GITHUB_OUTPUT
|
|
echo "pr_base_sha=$(echo "$PR_DATA" | jq -r '.base.sha')" >> $GITHUB_OUTPUT
|
|
echo "is_fork=$(echo "$PR_DATA" | jq -r '.head.repo.fork')" >> $GITHUB_OUTPUT
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
at-claude:
|
|
needs: get-pr-info
|
|
if: needs.get-pr-info.outputs.is_fork != 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
id-token: write
|
|
actions: read
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
enable-cache: true
|
|
cache-suffix: claude-code
|
|
|
|
- run: uv tool install pre-commit
|
|
|
|
- run: make install
|
|
|
|
- name: Install bubblewrap
|
|
run: sudo apt-get install -y bubblewrap
|
|
|
|
- uses: anthropics/claude-code-action@428971d2ecd6e3a7cb0ee0da2a3a8b33fdb3678d # v1.0.157
|
|
with:
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
additional_permissions: |
|
|
actions: read
|
|
claude_args: |
|
|
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr checks:*),Bash(gh pr list:*),Bash(gh pr create:*),Bash(gh issue view:*),Bash(gh issue list:*),Bash(gh run view:*),Bash(gh run list:*),Bash(git log:*),Bash(git diff:*),Bash(git grep:*),Bash(git show:*),Bash(git status:*),Bash(git add:*),Bash(git checkout:*),Bash(git commit:*),Bash(git push:*),Bash(rg:*),Bash(ls:*),Bash(tree:*),Bash(grep:*),Bash(uv run:*),Bash(make:*)"
|
|
|
|
at-claude-fork:
|
|
needs: get-pr-info
|
|
if: needs.get-pr-info.outputs.is_fork == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
# Least privilege: on forks Claude may only read code and comment (see the
|
|
# restricted --allowedTools below — no push / pr create), so this job runs
|
|
# with read-only `contents`. It never gets write access to repository code.
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
id-token: write
|
|
actions: read
|
|
steps:
|
|
- name: Checkout fork repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
repository: ${{ needs.get-pr-info.outputs.pr_head_repo }}
|
|
ref: ${{ needs.get-pr-info.outputs.pr_head_sha }}
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: Check for modified config files
|
|
# Compare the exact immutable SHAs captured in get-pr-info (and checked
|
|
# out above) rather than the live PR head. Using `gh pr diff` would read
|
|
# whatever the PR points at now, so a force-push after get-pr-info could
|
|
# slip a modified CLAUDE.md/AGENTS.md past this guard while different
|
|
# code is what actually runs (TOCTOU). Pinning to BASE_SHA...HEAD_SHA
|
|
# ties the check to the code Claude will see.
|
|
#
|
|
# Use the diff media type, not the compare JSON: the JSON `.files` array
|
|
# is capped at 300 entries (and `--paginate` only pages commits, not
|
|
# files), so a >300-file PR could hide an agent-config edit. The diff
|
|
# emits a `diff --git a/<old> b/<new>` header for every changed file,
|
|
# including renames, so matching those lines cannot miss a path.
|
|
run: |
|
|
CHANGED=$(gh api "repos/${{ github.repository }}/compare/${BASE_SHA}...${HEAD_SHA}" -H 'Accept: application/vnd.github.v3.diff' | grep '^diff --git ')
|
|
if echo "$CHANGED" | grep -qiE '/(AGENTS\.md|CLAUDE\.md)( |$)|/\.claude/'; then
|
|
echo "::error::PR modifies agent config files (AGENTS.md, CLAUDE.md, or .claude/). Skipping for security."
|
|
exit 1
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
BASE_SHA: ${{ needs.get-pr-info.outputs.pr_base_sha }}
|
|
HEAD_SHA: ${{ needs.get-pr-info.outputs.pr_head_sha }}
|
|
|
|
- name: Install bubblewrap
|
|
run: sudo apt-get install -y bubblewrap
|
|
|
|
- uses: anthropics/claude-code-action@428971d2ecd6e3a7cb0ee0da2a3a8b33fdb3678d # v1.0.157
|
|
with:
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
additional_permissions: |
|
|
actions: read
|
|
claude_args: |
|
|
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr checks:*),Bash(gh pr list:*),Bash(gh issue view:*),Bash(gh issue list:*),Bash(gh run view:*),Bash(gh run list:*),Bash(git log:*),Bash(git diff:*),Bash(git grep:*),Bash(git show:*),Bash(git status:*),Bash(rg:*),Bash(ls:*),Bash(tree:*),Bash(grep:*)"
|