Skip to content

Commit 678703a

Browse files
committed
add script and workflow to generate markdown page for search-space coverage
1 parent 4fbe5be commit 678703a

File tree

2 files changed

+578
-0
lines changed

2 files changed

+578
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: Update ML Parameter Coverage Documentation
2+
3+
on:
4+
# Trigger when search data is updated
5+
push:
6+
paths:
7+
- 'src/surfaces/search_data/**'
8+
- 'collect_ml_search_data.py'
9+
- 'generate_parameter_coverage_docs.py'
10+
11+
# Allow manual triggering
12+
workflow_dispatch:
13+
14+
# Run weekly to check for updates
15+
schedule:
16+
- cron: '0 6 * * 1' # Every Monday at 6 AM UTC
17+
18+
jobs:
19+
update-docs:
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: '3.9'
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install -r requirements.txt || echo "No requirements.txt found"
41+
# Install package in development mode
42+
pip install -e .
43+
44+
- name: Install additional ML dependencies
45+
run: |
46+
pip install scikit-learn numpy pandas
47+
48+
- name: Check if search data exists
49+
id: check_data
50+
run: |
51+
if [ -d "src/surfaces/search_data" ] && [ "$(ls -A src/surfaces/search_data 2>/dev/null)" ]; then
52+
echo "data_exists=true" >> $GITHUB_OUTPUT
53+
echo "Found search data files:"
54+
ls -la src/surfaces/search_data/
55+
else
56+
echo "data_exists=false" >> $GITHUB_OUTPUT
57+
echo "No search data found"
58+
fi
59+
60+
- name: Generate parameter coverage documentation
61+
run: |
62+
echo "Generating ML parameter coverage documentation..."
63+
python generate_parameter_coverage_docs.py --output docs/ML_PARAMETER_COVERAGE.md
64+
65+
# Also generate JSON data for potential API usage
66+
python generate_parameter_coverage_docs.py --json --output docs/ml_parameter_coverage.json
67+
68+
echo "Documentation generated successfully"
69+
70+
- name: Check for documentation changes
71+
id: check_changes
72+
run: |
73+
# Create docs directory if it doesn't exist
74+
mkdir -p docs
75+
76+
# Check if files have changed
77+
git add docs/ML_PARAMETER_COVERAGE.md docs/ml_parameter_coverage.json 2>/dev/null || true
78+
79+
if git diff --cached --quiet; then
80+
echo "changes_detected=false" >> $GITHUB_OUTPUT
81+
echo "No changes detected in documentation"
82+
else
83+
echo "changes_detected=true" >> $GITHUB_OUTPUT
84+
echo "Documentation changes detected"
85+
86+
# Show what changed
87+
echo "Changes:"
88+
git diff --cached --name-only
89+
fi
90+
91+
- name: Create Pull Request
92+
if: steps.check_changes.outputs.changes_detected == 'true'
93+
uses: peter-evans/create-pull-request@v5
94+
with:
95+
token: ${{ secrets.GITHUB_TOKEN }}
96+
commit-message: |
97+
📊 Update ML parameter coverage documentation
98+
99+
Auto-generated documentation update showing current parameter
100+
coverage for machine learning test functions.
101+
102+
- Updated ML_PARAMETER_COVERAGE.md with current database status
103+
- Updated ml_parameter_coverage.json with raw data
104+
105+
🤖 Generated with GitHub Actions
106+
title: "📊 Update ML Parameter Coverage Documentation"
107+
body: |
108+
## 📊 ML Parameter Coverage Documentation Update
109+
110+
This PR contains automatically generated updates to the machine learning parameter coverage documentation.
111+
112+
### What's Updated
113+
- `docs/ML_PARAMETER_COVERAGE.md` - Human-readable documentation tables
114+
- `docs/ml_parameter_coverage.json` - Machine-readable JSON data
115+
116+
### Current Status
117+
${{ steps.check_data.outputs.data_exists == 'true' && '✅ Search data databases found and analyzed' || '⚠️ No search data found - documentation shows default ranges only' }}
118+
119+
### How to Collect More Data
120+
To improve parameter coverage, run:
121+
```bash
122+
# Install dependencies
123+
pip install -e .
124+
125+
# Collect data for all ML functions
126+
python collect_ml_search_data.py --all
127+
128+
# Or collect for specific functions
129+
python collect_ml_search_data.py k_neighbors_classifier
130+
python collect_ml_search_data.py k_neighbors_regressor
131+
python collect_ml_search_data.py gradient_boosting_regressor
132+
```
133+
134+
### Manual Trigger
135+
This workflow can also be triggered manually from the Actions tab if you want to update documentation after collecting new data.
136+
137+
---
138+
🤖 **Auto-generated by GitHub Actions** • [View workflow](../actions/workflows/update-ml-parameter-docs.yml)
139+
branch: update-ml-docs
140+
delete-branch: true
141+
draft: false
142+
labels: |
143+
documentation
144+
automated
145+
ml-functions
146+
147+
- name: Summary
148+
run: |
149+
echo "## Workflow Summary" >> $GITHUB_STEP_SUMMARY
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
152+
if [ "${{ steps.check_data.outputs.data_exists }}" == "true" ]; then
153+
echo "✅ **Search data found**: Documentation generated from existing databases" >> $GITHUB_STEP_SUMMARY
154+
else
155+
echo "⚠️ **No search data found**: Documentation shows default parameter ranges only" >> $GITHUB_STEP_SUMMARY
156+
fi
157+
158+
echo "" >> $GITHUB_STEP_SUMMARY
159+
160+
if [ "${{ steps.check_changes.outputs.changes_detected }}" == "true" ]; then
161+
echo "📄 **Documentation updated**: A pull request has been created with the latest parameter coverage information" >> $GITHUB_STEP_SUMMARY
162+
else
163+
echo "📄 **No changes**: Documentation is already up to date" >> $GITHUB_STEP_SUMMARY
164+
fi
165+
166+
echo "" >> $GITHUB_STEP_SUMMARY
167+
echo "### Files Generated" >> $GITHUB_STEP_SUMMARY
168+
echo "- \`docs/ML_PARAMETER_COVERAGE.md\` - User-friendly documentation" >> $GITHUB_STEP_SUMMARY
169+
echo "- \`docs/ml_parameter_coverage.json\` - Machine-readable data" >> $GITHUB_STEP_SUMMARY
170+
171+
echo "" >> $GITHUB_STEP_SUMMARY
172+
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
173+
echo "1. Review the generated pull request if changes were detected" >> $GITHUB_STEP_SUMMARY
174+
echo "2. To collect more data, run \`python collect_ml_search_data.py --all\`" >> $GITHUB_STEP_SUMMARY
175+
echo "3. Commit any new search data to trigger automatic documentation updates" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)