Files
my-vault/.github/workflows/claude.yml
T
Noah Brier 94869b6b04 feat: configure Claude GitHub Action with permissions and restrictions
- Add write permissions for contents, pull-requests, and issues
- Configure allowed tools for pnpm, git, gh CLI, and file operations
- Restrict Claude activation to repository owner (heyitsnoah) only
- Update init-bootstrap to ask about development work
  - Personal vault users: Remove .github folder and disconnect from origin
  - Contributors: Keep GitHub workflows and origin for development
- Prevents personal vault users from seeing confusing GitHub Actions failures
2025-09-14 16:06:49 -04:00

82 lines
2.8 KiB
YAML

name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.actor == 'heyitsnoah' || github.actor == 'dependabot[bot]') &&
(
(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')))
)
runs-on: ubuntu-latest
permissions:
contents: write # Allow Claude to push changes
pull-requests: write # Allow Claude to create/modify PRs
issues: write # Allow Claude to create/update issues
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Allow Claude to run specific tools and commands
allowed_tools: |
Bash(pnpm install)
Bash(pnpm setup)
Bash(pnpm attachments:*)
Bash(pnpm vault:stats)
Bash(pnpm check-updates)
Bash(npm run *)
Bash(git status)
Bash(git diff *)
Bash(git log *)
Bash(git add *)
Bash(git commit *)
Bash(git push)
Bash(gh pr *)
Bash(gh issue *)
Bash(ls *)
Bash(cat *)
Bash(grep *)
Bash(find *)
View
GlobTool
GrepTool
BatchTool
Read
Write
Edit
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
# claude_args: '--model claude-opus-4-1-20250805'