Data Update #76
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: "Data Update" | |
on: | |
schedule: | |
- cron: "0 2 * * *" # At 2:00 AM UTC every day | |
workflow_dispatch: # Allow manual triggering | |
permissions: | |
contents: "read" # for checkout | |
jobs: | |
update-data: | |
name: "Update AI Model Registry Data" | |
if: "github.repository == 'anolilab/ai-models'" | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "write" | |
steps: | |
- name: "Harden Runner" | |
uses: "step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911" # v2.13.0 | |
with: | |
egress-policy: "audit" | |
- name: "Git checkout" | |
uses: "actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8" # v5.0.0 | |
with: | |
token: "${{ secrets.LOCK_MAINTENANCE_GITHUB_TOKEN }}" | |
env: | |
GIT_COMMITTER_NAME: "GitHub Actions Shell" | |
GIT_AUTHOR_NAME: "GitHub Actions Shell" | |
EMAIL: "github-actions[bot]@users.noreply.github.com" | |
- name: "Setup resources and environment" | |
id: "setup" | |
uses: "anolilab/workflows/step/setup@main" | |
with: | |
node-version: "22.x" | |
cache-prefix: "data-update" | |
- name: "Install Chrome for Puppeteer" | |
if: "${{ success() }}" | |
run: "pnpm exec nx run ai-model-registry:install:chrome" | |
- name: "Ensure data directory exists" | |
if: "${{ success() }}" | |
run: "mkdir -p packages/ai-model-registry/data/providers" | |
- name: "Prepare AI Model Registry Data" | |
if: "${{ success() }}" | |
run: "pnpm exec nx run ai-model-registry:prepare-data" | |
- name: "Format and lint generated files" | |
if: "${{ success() }}" | |
run: | | |
cd packages/ai-model-registry | |
pnpm exec prettier --write public/api.json src/icons-sprite.ts | |
pnpm exec eslint --fix src/icons-sprite.ts | |
- name: "Commit updated data" | |
if: "${{ success() }} && steps.changes.outputs.no_changes == 'false'" | |
uses: "stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0" # v6.0.1 | |
with: | |
file_pattern: | | |
packages/ai-model-registry/public/api.json | |
packages/ai-model-registry/src/icons-sprite.ts | |
commit_message: "feat: updated AI model registry data" | |
commit_user_name: "github-actions-shell" | |
commit_user_email: "github-actions[bot]@users.noreply.github.com" | |
commit_author: "github-actions-shell <github-actions[bot]@users.noreply.github.com>" |