Skip to main content
Glama
skolverket-sync.yml3.25 kB
name: Skolverket API Auto-Sync on: schedule: # Körs 04:00 CET varje natt - cron: '0 4 * * *' workflow_dispatch: # För manuell körning jobs: sync-and-verify: runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: 🔒 Backup current state id: backup run: | echo "💾 Creating safety backup..." git add -A git stash push -m "Auto-backup before API sync $(date +%Y-%m-%d_%H-%M-%S)" || echo "No changes to stash" echo "backup_created=true" >> $GITHUB_OUTPUT - name: Generate API Types id: generate continue-on-error: true run: | # Kör skriptet vi skapade ovan npx tsx scripts/update-api-types.ts # Kontrollera om git ser några ändringar i generated-mappen if [[ -n $(git status --porcelain src/types/generated/) ]]; then echo "changed=true" >> $GITHUB_OUTPUT echo "✅ Changes detected in API definitions" else echo "changed=false" >> $GITHUB_OUTPUT echo "No changes detected" fi - name: Safety Check (Gatekeeper) id: safety_check if: steps.generate.outputs.changed == 'true' && steps.generate.outcome == 'success' continue-on-error: true run: | echo "🛡️ Verifying compatibility with existing code..." npm test tests/contract/type-safety.test.ts npm run build - name: 🔄 Auto-restore on failure if: steps.generate.outcome == 'failure' || steps.safety_check.outcome == 'failure' run: | echo "❌ Generation or tests failed - restoring previous state..." git reset --hard HEAD git stash pop || echo "No stash to restore" echo "✅ Restored to safe state" exit 1 - name: 🧹 Cleanup backup on success if: steps.generate.outcome == 'success' && (steps.safety_check.outcome == 'success' || steps.generate.outputs.changed == 'false') run: | git stash drop || echo "No stash to drop" - name: Create Pull Request if: steps.generate.outputs.changed == 'true' && success() uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} branch: skolverket-api-update title: "🤖 API Update: Skolverket specs changed" body: | ### 🤖 Skolverket API Update Detected The nightly scan detected changes in one or more of Skolverket's APIs (Syllabus v1, School Units v2, or Planned Education v4). **Safety Report:** - ✅ Generated types updated in `src/types/generated/` - ✅ Contract Tests: Passed (Backward compatible) - ✅ Build Check: Passed **Action:** Merge this PR to keep the internal schema definitions up to date.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/isakskogstad/skolverket-syllabus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server