Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/claude-documentation-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Documentation Fixer

on:
issue_comment:
types: [created]

jobs:
claude-response:
runs-on: ubuntu-latest
# Only run on PR comments that mention @claude
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude')
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Get PR branch
id: pr-info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_DATA=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName,headRefOid)
echo "branch=$(echo "$PR_DATA" | jq -r '.headRefName')" >> "$GITHUB_OUTPUT"

- name: Checkout repository
uses: actions/checkout@v4
with:
# Check out the branch by name so git push works.
ref: ${{ steps.pr-info.outputs.branch }}
fetch-depth: 0

- name: Apply fixes
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
show_full_output: true
claude_args: |
--model claude-sonnet-4-5-20250929
--allowedTools "Read,Write,Edit,Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr comment:*),Bash(git config:*),Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(git status:*),Bash(git diff:*)"
42 changes: 5 additions & 37 deletions .github/workflows/claude-documentation-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,26 @@ on:
types: [opened, edited, reopened, synchronize]
paths:
- '**.md'
issue_comment:
types: [created]

jobs:
claude-response:
runs-on: ubuntu-latest
# For issue_comment events, only run on PR comments that mention @claude
if: |
github.event_name == 'pull_request_target' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude'))
permissions:
contents: write
contents: read
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Get PR branch for issue_comment events
id: pr-info
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_DATA=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName,headRefOid)
echo "branch=$(echo "$PR_DATA" | jq -r '.headRefName')" >> "$GITHUB_OUTPUT"

- name: Checkout repository
uses: actions/checkout@v4
with:
# For fix mode, check out the branch by name so git push works.
# For review mode, check out by SHA to prevent TOCTOU attacks from forks.
ref: ${{ github.event_name == 'issue_comment' && steps.pr-info.outputs.branch || github.event.pull_request.head.sha || github.sha }}
# Check out by SHA to prevent TOCTOU attacks from forks.
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Get changed markdown files
id: changed-files
if: github.event_name == 'pull_request_target'
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
Expand All @@ -61,7 +42,7 @@ jobs:
fi

- name: Delete existing review comment
if: github.event_name == 'pull_request_target' && steps.changed-files.outputs.count > 0
if: steps.changed-files.outputs.count > 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down Expand Up @@ -93,10 +74,9 @@ jobs:
echo "EOF"
} >> "$GITHUB_OUTPUT"

# Review mode: auto-triggered when markdown files change in a PR
- name: Run documentation review
if: steps.changed-files.outputs.count > 0
uses: anthropics/claude-code-action@v1
if: github.event_name == 'pull_request_target' && steps.changed-files.outputs.count > 0
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -118,15 +98,3 @@ jobs:
--model claude-sonnet-4-5-20250929
--allowedTools "Write,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr comment:*)"
--append-system-prompt "${{ steps.read-prompt.outputs.prompt }}"

# Fix mode: triggered when someone comments @claude on a PR
- name: Apply fixes on @claude request
uses: anthropics/claude-code-action@v1
if: github.event_name == 'issue_comment'
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
show_full_output: true
claude_args: |
--model claude-sonnet-4-5-20250929
--allowedTools "Read,Write,Edit,Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr comment:*),Bash(git config:*),Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(git status:*),Bash(git diff:*)"
Loading