Add icons #242
Workflow file for this run
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: Model Analysis Check | |
on: | |
push: | |
paths: | |
- 'templates/**.json' | |
- 'scripts/analyze_models.py' | |
- '.github/workflows/model-analysis.yml' | |
pull_request: | |
paths: | |
- 'templates/**.json' | |
- 'scripts/analyze_models.py' | |
- '.github/workflows/model-analysis.yml' | |
permissions: | |
contents: read | |
pull-requests: write # Allow commenting on PRs | |
jobs: | |
model-analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Run model analysis script | |
id: model_analysis | |
run: | | |
echo "Running model analysis..." | |
python scripts/analyze_models.py > model_analysis_report.txt 2>&1 || echo "model_analysis_failed=true" >> $GITHUB_OUTPUT | |
cat model_analysis_report.txt | |
# Check if analysis failed | |
if grep -q "\[FAIL\]" model_analysis_report.txt; then | |
echo "model_analysis_failed=true" >> $GITHUB_OUTPUT | |
echo "::error::Model analysis found issues. See report above." | |
else | |
echo "model_analysis_failed=false" >> $GITHUB_OUTPUT | |
fi | |
continue-on-error: true | |
- name: Comment on PR about model analysis results | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
// Read model analysis report | |
let report = ''; | |
try { | |
report = fs.readFileSync('model_analysis_report.txt', 'utf8'); | |
} catch (error) { | |
report = 'Unable to read model analysis report'; | |
} | |
const hasFailed = '${{ steps.model_analysis.outputs.model_analysis_failed }}' === 'true'; | |
let comment = ''; | |
if (hasFailed) { | |
comment = `## ❌ Model Analysis Check Failed | |
Model configuration issues were found in your template files that need to be fixed. | |
**Why this matters:** Model configurations in templates must be correct to ensure users can download and use the right model files. Incorrect configurations will cause templates to fail. | |
### Analysis Report: | |
\`\`\` | |
${report} | |
\`\`\` | |
### Common Issues and How to Fix: | |
1. **Missing properties.models configuration**: | |
- Add \`properties.models\` array to nodes that use .safetensors files | |
- Ensure the array contains model name, download URL, and directory information | |
2. **widgets_values and properties.models mismatch**: | |
- Ensure model filenames in \`widgets_values\` match the \`name\` field in \`properties.models\` | |
- Check for exact spelling and case sensitivity | |
3. **Markdown link errors**: | |
- Ensure \`[filename.safetensors](url)\` links have consistent filenames between text and URL | |
4. **Subgraph nodes**: | |
- Note: Subgraph nodes (UUID-type) are automatically skipped from model validation | |
- Their model configurations are handled within the subgraph definition | |
Please fix these issues and resubmit.`; | |
} else { | |
comment = `## ✅ Model Analysis Check Passed | |
All template files have correct model configurations! | |
### Analysis Report: | |
\`\`\` | |
${report} | |
\`\`\` | |
🤖 *This check was generated by automated workflow*`; | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}); | |
- name: Fail job if model analysis issues found | |
if: steps.model_analysis.outputs.model_analysis_failed == 'true' | |
run: | | |
echo "❌ Model analysis failed with issues" | |
exit 1 |