Claude Code doc review exp #5
This file contains hidden or 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 Review" | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| documentation-review: | |
| name: Review doc changes | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed to access base branch for git diff | |
| # Step 1: Analyze code changes | |
| - name: Step 1 - Analyze code changes | |
| id: analyze-changes | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| prompt: | | |
| **STEP 1: Analyze code changes** | |
| Your task: | |
| 1. Run: git diff origin/${{ github.base_ref }}...HEAD | |
| 2. List all changed files | |
| 3. Identify which modules were changed (e.g., application, platform, wsi, etc.) | |
| Write results to a file: /tmp/step1-changes.txt | |
| Format: | |
| ``` | |
| CHANGED_FILES: | |
| - path/to/file1.py | |
| - path/to/file2.py | |
| MODULES_CHANGED: | |
| - application | |
| - platform | |
| SUMMARY: | |
| [One sentence describing the changes] | |
| ``` | |
| Keep it simple - just identify what changed and which modules. | |
| claude_args: >- | |
| --max-turns 10 | |
| --model claude-sonnet-4-5-20250929 | |
| - name: Upload step 1 results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: step1-changes | |
| path: /tmp/step1-changes.txt | |
| retention-days: 1 | |
| # Step 2: Read relevant requirements and specifications | |
| - name: Step 2 - Read requirements and specs | |
| id: read-requirements | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| prompt: | | |
| **STEP 2: Read relevant requirements and specifications** | |
| Your task: | |
| 1. Read the file: /tmp/step1-changes.txt (from previous step) | |
| 2. Based on MODULES_CHANGED, read related files from: | |
| - requirements/ directory (stakeholder + software requirements) | |
| - specifications/ directory (software item specs) | |
| Example: If "application" module changed, read: | |
| - requirements/SHR-APPLICATION-*.md | |
| - requirements/SWR-APPLICATION-*.md | |
| - specifications/SPEC-APPLICATION-SERVICE.md | |
| Write a summary to: /tmp/step2-requirements.txt | |
| Format: | |
| ``` | |
| REQUIREMENTS_READ: | |
| - requirements/SHR-APPLICATION-1.md: [Brief summary of requirement] | |
| - requirements/SWR-APPLICATION-1-1.md: [Brief summary] | |
| SPECS_READ: | |
| - specifications/SPEC-APPLICATION-SERVICE.md: [Brief summary] | |
| TOTAL_FILES_READ: [number] | |
| ``` | |
| claude_args: >- | |
| --max-turns 15 | |
| --model claude-sonnet-4-5-20250929 | |
| - name: Upload step 2 results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: step2-requirements | |
| path: /tmp/step2-requirements.txt | |
| retention-days: 1 | |
| # Step 3: Identify requirements/specs that need updates | |
| - name: Step 3 - Identify impact on requirements | |
| id: identify-impact | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| prompt: | | |
| **STEP 3: Identify requirements/specs that need updates** | |
| Your task: | |
| 1. Read /tmp/step1-changes.txt (code changes) | |
| 2. Read /tmp/step2-requirements.txt (requirements/specs) | |
| 3. Identify which requirements or specs might need updates based on code changes | |
| Write results to: /tmp/step3-impact.txt | |
| Format: | |
| ``` | |
| REQUIREMENTS_TO_UPDATE: | |
| - requirements/SHR-APPLICATION-1.md: [1-sentence: what needs to change and why] | |
| - requirements/SWR-APPLICATION-1-1.md: [1-sentence: what needs to change and why] | |
| SPECS_TO_UPDATE: | |
| - specifications/SPEC-APPLICATION-SERVICE.md: [1-sentence: what needs to change and why] | |
| NO_CHANGES_NEEDED: | |
| - [List requirements/specs that are still accurate] | |
| SUMMARY: | |
| [Overall assessment of documentation impact] | |
| ``` | |
| Be specific - explain WHY each document needs updating based on the code changes. | |
| claude_args: >- | |
| --max-turns 15 | |
| --model claude-sonnet-4-5-20250929 | |
| - name: Upload step 3 results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: step3-impact | |
| path: /tmp/step3-impact.txt | |
| retention-days: 1 | |
| # Post summary comment to PR | |
| - name: Post summary to PR | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| let comment = '## 📋 Requirements & Specifications Review\n\n'; | |
| comment += '_This is a verification test of Claude Code automation._\n\n'; | |
| try { | |
| const step1 = fs.readFileSync('/tmp/step1-changes.txt', 'utf8'); | |
| comment += '### Step 1: Code Changes\n```\n' + step1 + '\n```\n\n'; | |
| } catch (e) { | |
| comment += '### Step 1: Code Changes\n❌ No results found\n\n'; | |
| } | |
| try { | |
| const step2 = fs.readFileSync('/tmp/step2-requirements.txt', 'utf8'); | |
| comment += '### Step 2: Requirements & Specs Read\n```\n' + step2 + '\n```\n\n'; | |
| } catch (e) { | |
| comment += '### Step 2: Requirements & Specs Read\n❌ No results found\n\n'; | |
| } | |
| try { | |
| const step3 = fs.readFileSync('/tmp/step3-impact.txt', 'utf8'); | |
| comment += '### Step 3: Documentation Impact Analysis\n```\n' + step3 + '\n```\n\n'; | |
| } catch (e) { | |
| comment += '### Step 3: Documentation Impact Analysis\n❌ No results found\n\n'; | |
| } | |
| comment += '---\n_🤖 Generated by Claude Code automation_'; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: comment | |
| }); |