-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (193 loc) · 7.64 KB
/
continuous-improvement.yml
File metadata and controls
235 lines (193 loc) · 7.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: "Continuous Improvement"
on:
schedule:
- cron: "0 3 * * 1" # Run weekly on Monday at 3 AM UTC
workflow_dispatch:
permissions:
contents: read
pull-requests: write
issues: read
jobs:
code-simplification:
name: "Code Simplification Analysis"
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find largest files
id: analyze
run: |
LARGE_FILES=$(find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" \) \
-not -path "./node_modules/*" \
-not -path "./vendor/*" \
-not -path "./.git/*" \
-exec wc -l {} + 2>/dev/null | sort -rn | head -20)
echo "$LARGE_FILES" > large-files.txt
echo "large_files=$LARGE_FILES" >> $GITHUB_OUTPUT
cat large-files.txt
- name: Find duplicate code
run: |
echo "Searching for potential code duplication patterns..."
# This is a simplified check - a real implementation might use CPD or similar
- name: Run Simplification Analysis
uses: google-github-actions/run-gemini-cli@v0.1.21
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
prompt: |
You are an expert software architect. Analyze the codebase for simplification opportunities.
## Largest Files
${{ steps.analyze.outputs.large_files }}
## Your Task
Identify opportunities for code simplification:
1. **Complex functions** that could be broken down
2. **Duplicate code** that could be extracted
3. **Overly complex conditionals** that could be simplified
4. **Long functions** that should be refactored
5. **Dead code** that could be removed
6. **Magic numbers/strings** that should be constants
7. **Nested callbacks** that could use async/await
## Response Format
```
## Code Simplification Opportunities
### High Priority
| File | Lines | Issue | Suggested Refactor |
|------|-------|-------|---------------------|
### Medium Priority
[Similar table]
### Suggestions for Next Week
[Top 3-5 actionable items]
```
Focus on impactful changes that improve maintainability.
gemini_model: gemini-2.5-flash
gemini_debug: ${{ vars.GEMINI_DEBUG == 'true' }}
- name: Create improvement report
if: always()
run: |
SUMMARY="${{ steps.gemini.outputs.summary }}"
cat > /tmp/improvement_report.md << 'EOF'
## Weekly Code Simplification Analysis
$SUMMARY
---
*Generated by Gemini CLI*
EOF
gh issue create \
--title "Weekly Code Simplification Report - $(date +'%Y-%m-%d')" \
--body "$(cat /tmp/improvement_report.md)" \
--label "improvement,automated,report"
test-coverage-analysis:
name: "Test Coverage Analysis"
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Coverage Analysis
uses: google-github-actions/run-gemini-cli@v0.1.21
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
prompt: |
Analyze this codebase for test coverage improvements.
## Your Task
1. Identify files/modules that lack tests
2. Suggest high-value test cases
3. Look for edge cases that aren't covered
4. Identify untested public APIs
5. Suggest integration vs unit test balance
## Response Format
```
## Test Coverage Recommendations
### Untested Critical Areas
| File/Module | Why It Matters | Priority |
|-------------|-----------------|---------|
### Suggested Test Cases
1. [Specific test scenario with expected behavior]
### Edge Cases to Cover
[List important edge cases]
```
Be specific about what should be tested and why.
gemini_model: gemini-2.5-flash
gemini_debug: ${{ vars.GEMINI_DEBUG == 'true' }}
- name: Post recommendations
if: always()
run: |
SUMMARY="${{ steps.gemini.outputs.summary }}"
cat > /tmp/coverage_report.md << 'EOF'
## Test Coverage Analysis
$SUMMARY
---
*Generated by Gemini CLI*
EOF
gh issue create \
--title "Test Coverage Recommendations - $(date +'%Y-%m-%d')" \
--body "$(cat /tmp/coverage_report.md)" \
--label "testing,automated,report"
dependency-review:
name: "Dependency Health Check"
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Check dependencies
id: deps
run: |
DEPS=""
if [ -f "package.json" ]; then
DEPS=$(npm list --depth=0 2>/dev/null || echo "No dependencies")
elif [ -f "requirements.txt" ]; then
DEPS=$(pip list 2>/dev/null || echo "pip not available")
elif [ -f "go.mod" ]; then
DEPS=$(go list -m all 2>/dev/null || echo "No dependencies")
elif [ -f "Cargo.toml" ]; then
DEPS=$(cargo tree --depth 1 2>/dev/null || echo "cargo tree not available")
else
DEPS="No dependency file found"
fi
echo "$DEPS" > dependencies.txt
echo "dependencies=$DEPS" >> $GITHUB_OUTPUT
cat dependencies.txt
- name: Analyze dependencies
uses: google-github-actions/run-gemini-cli@v0.1.21
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
prompt: |
Review these dependencies for potential issues.
## Dependencies
${{ steps.deps.outputs.dependencies }}
## Your Task
1. Identify outdated packages
2. Flag packages with known vulnerabilities
3. Note packages that are unused (if detectable)
4. Suggest security updates
5. Identify heavy dependencies that might slow builds
## Response Format
```
## Dependency Health Report
### Updates Needed
| Package | Current | Recommended | Reason |
|---------|---------|--------------|--------|
### Security Concerns
[Any packages with vulnerabilities]
### Optimization Opportunities
[Heavy or unnecessary dependencies]
```
gemini_model: gemini-2.5-flash-lite
gemini_debug: ${{ vars.GEMINI_DEBUG == 'true' }}
- name: Post dependency report
if: always()
run: |
SUMMARY="${{ steps.gemini.outputs.summary }}"
cat > /tmp/deps_report.md << 'EOF'
## Dependency Analysis
$SUMMARY
---
*Generated by Gemini CLI*
EOF
gh issue create \
--title "Dependency Health Report - $(date +'%Y-%m-%d')" \
--body "$(cat /tmp/deps_report.md)" \
--label "dependencies,automated,report"