Skip to content

Commit 3f323d8

Browse files
add claude code new workflow
1 parent b57e344 commit 3f323d8

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: "+ Claude Code / Documentation Review"
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
documentation-review:
13+
name: Review doc changes
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Needed to access base branch for git diff
21+
22+
# Step 1: Analyze code changes
23+
- name: Step 1 - Analyze code changes
24+
id: analyze-changes
25+
uses: anthropics/claude-code-action@v1
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
29+
prompt: |
30+
**STEP 1: Analyze code changes**
31+
32+
Your task:
33+
1. Run: git diff origin/${{ github.base_ref }}...HEAD
34+
2. List all changed files
35+
3. Identify which modules were changed (e.g., application, platform, wsi, etc.)
36+
37+
Write results to a file: /tmp/step1-changes.txt
38+
39+
Format:
40+
```
41+
CHANGED_FILES:
42+
- path/to/file1.py
43+
- path/to/file2.py
44+
45+
MODULES_CHANGED:
46+
- application
47+
- platform
48+
49+
SUMMARY:
50+
[One sentence describing the changes]
51+
```
52+
53+
Keep it simple - just identify what changed and which modules.
54+
claude_args: >-
55+
--max-turns 10
56+
--model claude-sonnet-4-5-20250929
57+
58+
- name: Upload step 1 results
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: step1-changes
62+
path: /tmp/step1-changes.txt
63+
retention-days: 1
64+
65+
# Step 2: Read relevant requirements and specifications
66+
- name: Step 2 - Read requirements and specs
67+
id: read-requirements
68+
uses: anthropics/claude-code-action@v1
69+
with:
70+
github_token: ${{ secrets.GITHUB_TOKEN }}
71+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
72+
prompt: |
73+
**STEP 2: Read relevant requirements and specifications**
74+
75+
Your task:
76+
1. Read the file: /tmp/step1-changes.txt (from previous step)
77+
2. Based on MODULES_CHANGED, read related files from:
78+
- requirements/ directory (stakeholder + software requirements)
79+
- specifications/ directory (software item specs)
80+
81+
Example: If "application" module changed, read:
82+
- requirements/SHR-APPLICATION-*.md
83+
- requirements/SWR-APPLICATION-*.md
84+
- specifications/SPEC-APPLICATION-SERVICE.md
85+
86+
Write a summary to: /tmp/step2-requirements.txt
87+
88+
Format:
89+
```
90+
REQUIREMENTS_READ:
91+
- requirements/SHR-APPLICATION-1.md: [Brief summary of requirement]
92+
- requirements/SWR-APPLICATION-1-1.md: [Brief summary]
93+
94+
SPECS_READ:
95+
- specifications/SPEC-APPLICATION-SERVICE.md: [Brief summary]
96+
97+
TOTAL_FILES_READ: [number]
98+
```
99+
claude_args: >-
100+
--max-turns 15
101+
--model claude-sonnet-4-5-20250929
102+
103+
- name: Upload step 2 results
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: step2-requirements
107+
path: /tmp/step2-requirements.txt
108+
retention-days: 1
109+
110+
# Step 3: Identify requirements/specs that need updates
111+
- name: Step 3 - Identify impact on requirements
112+
id: identify-impact
113+
uses: anthropics/claude-code-action@v1
114+
with:
115+
github_token: ${{ secrets.GITHUB_TOKEN }}
116+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
117+
prompt: |
118+
**STEP 3: Identify requirements/specs that need updates**
119+
120+
Your task:
121+
1. Read /tmp/step1-changes.txt (code changes)
122+
2. Read /tmp/step2-requirements.txt (requirements/specs)
123+
3. Identify which requirements or specs might need updates based on code changes
124+
125+
Write results to: /tmp/step3-impact.txt
126+
127+
Format:
128+
```
129+
REQUIREMENTS_TO_UPDATE:
130+
- requirements/SHR-APPLICATION-1.md: [1-sentence: what needs to change and why]
131+
- requirements/SWR-APPLICATION-1-1.md: [1-sentence: what needs to change and why]
132+
133+
SPECS_TO_UPDATE:
134+
- specifications/SPEC-APPLICATION-SERVICE.md: [1-sentence: what needs to change and why]
135+
136+
NO_CHANGES_NEEDED:
137+
- [List requirements/specs that are still accurate]
138+
139+
SUMMARY:
140+
[Overall assessment of documentation impact]
141+
```
142+
143+
Be specific - explain WHY each document needs updating based on the code changes.
144+
claude_args: >-
145+
--max-turns 15
146+
--model claude-sonnet-4-5-20250929
147+
148+
- name: Upload step 3 results
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: step3-impact
152+
path: /tmp/step3-impact.txt
153+
retention-days: 1
154+
155+
# Post summary comment to PR
156+
- name: Post summary to PR
157+
uses: actions/github-script@v7
158+
with:
159+
github-token: ${{ secrets.GITHUB_TOKEN }}
160+
script: |
161+
const fs = require('fs');
162+
163+
let comment = '## 📋 Requirements & Specifications Review\n\n';
164+
comment += '_This is a verification test of Claude Code automation._\n\n';
165+
166+
try {
167+
const step1 = fs.readFileSync('/tmp/step1-changes.txt', 'utf8');
168+
comment += '### Step 1: Code Changes\n```\n' + step1 + '\n```\n\n';
169+
} catch (e) {
170+
comment += '### Step 1: Code Changes\n❌ No results found\n\n';
171+
}
172+
173+
try {
174+
const step2 = fs.readFileSync('/tmp/step2-requirements.txt', 'utf8');
175+
comment += '### Step 2: Requirements & Specs Read\n```\n' + step2 + '\n```\n\n';
176+
} catch (e) {
177+
comment += '### Step 2: Requirements & Specs Read\n❌ No results found\n\n';
178+
}
179+
180+
try {
181+
const step3 = fs.readFileSync('/tmp/step3-impact.txt', 'utf8');
182+
comment += '### Step 3: Documentation Impact Analysis\n```\n' + step3 + '\n```\n\n';
183+
} catch (e) {
184+
comment += '### Step 3: Documentation Impact Analysis\n❌ No results found\n\n';
185+
}
186+
187+
comment += '---\n_🤖 Generated by Claude Code automation_';
188+
189+
await github.rest.issues.createComment({
190+
owner: context.repo.owner,
191+
repo: context.repo.repo,
192+
issue_number: context.issue.number,
193+
body: comment
194+
});

0 commit comments

Comments
 (0)