Last active
March 26, 2025 15:54
-
-
Save RDeluxe/653d80e72b56de47f3f1299d86730256 to your computer and use it in GitHub Desktop.
Claude Code Documentation Github Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Claude Code Documentation Update | |
on: | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
documentation-update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Claude Code | |
run: | | |
npm install -g @anthropic-ai/claude-code | |
# Check the PR diff using the current branch and the base branch of the PR | |
- uses: GrantBirki/[email protected] | |
id: git-diff-action | |
with: | |
json_diff_file_output: diff.json | |
raw_diff_file_output: diff.txt | |
file_output_only: 'true' | |
- name: print raw diff | |
env: | |
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} | |
run: cat $DIFF | |
- name: Update Documentation with Claude Code | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} | |
run: | | |
npx claude -p "Suggest documentation / code comments updates based on the current git changes. Do not add comments un-related to the changes : | |
- Do not explain your reasoning. Just modify the files. | |
- Do NOT ADD COMMENT WHEN NOT NEEDED. Remember to keep things "DRY" and "KISS". | |
- Comments that cleary repeats a clear code are not necessary, don't state the obvious. | |
- Do NOT UPDATE CURSOR RULES, which are files under .cursor/rules | |
- Remember to focus the "Why" and not the "How" | |
- When asked to update documentation, check all the mardown files from the repository to see if they NEED to be updated (update current content or add new one) | |
1. Review the diff files at $DIFF | |
2. Identify areas where documentation needs to be added or updated | |
3. Make precise, targeted changes to documentation files | |
4. Focus on clarity, completeness, and relevance to the code changes" \ | |
--allowedTools \ | |
"Edit" \ | |
"Bash(ls:*)" | |
- uses: parkerbxyz/suggest-changes@v1 | |
with: | |
comment: Please check the suggested changes from Claude. | |
event: REQUEST_CHANGES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment