Skip to content

Update Model Registry #274

Update Model Registry

Update Model Registry #274

Workflow file for this run

name: Update Model Registry
on:
schedule:
- cron: "15 6 * * *"
- cron: "15 18 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-models:
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.12"
- name: Install dependencies
run: python -m pip install --upgrade pip jsonschema pytest
- name: Build registry
run: python scripts/build_registry.py --report-md tmp/build/report.md
- name: Validate registry
run: python scripts/validate.py --models models.json --schema schema.json
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: registry-build
path: |
models.json
models.min.json
tmp/build/report.json
tmp/build/report.md
- name: Create PR if registry changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add models.json models.min.json
if git diff --staged --quiet; then
echo "No registry changes detected."
exit 0
fi
change_status=0
python scripts/check_registry_changes.py --base-ref HEAD models.json models.min.json || change_status=$?
if [ "$change_status" -eq 10 ]; then
echo "Only date-related registry fields changed."
exit 0
fi
if [ "$change_status" -ne 0 ]; then
exit "$change_status"
fi
BRANCH="update/model-registry-${GITHUB_RUN_ID}"
git checkout -b "$BRANCH"
git commit -m "chore: update model registry $(date -u +%Y-%m-%d)"
git push -u origin "$BRANCH"
gh pr create \
--title "chore: update model registry $(date -u +%Y-%m-%d)" \
--body-file tmp/build/report.md \
--base main