Skip to content

Refine agent contribution guidance #779

Refine agent contribution guidance

Refine agent contribution guidance #779

Workflow file for this run

name: Claude
# Interactive `@claude` assistant. Triggered by mentioning `@claude` in:
# - PR or issue comments
# - PR review comments (line-level review threads)
# - PR review bodies
# - Issue body or title (when the issue is opened)
#
# Restricted to NVIDIA org members / collaborators to prevent abuse from
# external contributors (the repo is public).
#
# `contents: write` lets Claude push branches and open PRs.
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
issues:
types: [opened, assigned]
jobs:
claude:
name: Claude (interactive)
# Fire only when @claude is mentioned by an NVIDIA org member, owner,
# or collaborator. Skip if the comment is also a `/claude review`
# invocation — that's handled by claude_review.yml.
if: |
(
(github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '@claude') &&
!contains(github.event.comment.body, '/claude review') &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
) ||
(github.event_name == 'pull_request_review_comment' &&
contains(github.event.comment.body, '@claude') &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
) ||
(github.event_name == 'pull_request_review' &&
contains(github.event.review.body, '@claude') &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)
) ||
(github.event_name == 'issues' &&
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association)
)
)
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install and enable pre-commit hooks
# Installs the git hook so any `git commit` Claude runs is
# subject to the same lint/format/license-header checks as a
# local developer commit — preventing PRs that fail CI on
# code-quality.
run: |
pip install pre-commit
pre-commit install
- name: Run Claude
uses: anthropics/claude-code-action@v1
env:
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
# NVIDIA inference proxy (LiteLLM-based) rejects two fields
# the Claude Code SDK sends by default. Set per NVIDIA/OSMO's
# workflow which has hit and solved both issues:
# - `context_management` → disable experimental betas
# - `cache_control.ephemeral.scope` → disable prompt caching
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1"
DISABLE_PROMPT_CACHING: "1"
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
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 create:*),Bash(gh issue view:*),Bash(gh issue comment:*),Bash(git diff:*),Bash(git show:*),Bash(git log:*),Bash(git status:*),Bash(git checkout:*),Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(pre-commit:*),Read,Edit,Write,Grep,Glob"
--model "${{ vars.CLAUDE_MODEL }}"