Skip to content

Continuous Improvement #11

Continuous Improvement

Continuous Improvement #11

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"