fix(sportySync): drive sporty.no sync via GitHub Actions cron (SWA managed functions ignore timer triggers) - #269
Merged
Conversation
…ctions ignore timer triggers
Azure Static Web Apps managed functions run HTTP triggers only; the
app.timer('sportySyncTimer', ...) trigger never registered in production,
so the sporty.no calendar sync never ran.
- Remove the dead timer trigger; document the platform limitation (#270)
- Add .github/workflows/sporty-sync.yml cron (04/11/14/22 UTC, daysBack=7)
- Accept X-Api-Key (SPORTY_SYNC_API_KEY) machine auth on POST /api/sporty-sync
alongside the existing X-Supabase-Token JWT for manual kicks
- Update CLAUDE.md, README.md, CHANGELOG.md; bump version to 1.5.17
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FwvkU2RBksppoWttDEcfB1
ChristopherRotnes
temporarily deployed
to
preview
June 25, 2026 05:20 — with
GitHub Actions
Inactive
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-269.westeurope.7.azurestaticapps.net |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The automatic sporty.no calendar sync never ran in production. It was implemented as an Azure Functions timer trigger (
app.timer('sportySyncTimer', ...)), but the app deploys as Azure Static Web Apps managed functions (api_location: "app/api"), which run HTTP triggers only — timer/cron triggers are silently ignored and never register (Microsoft Learn, SWA FAQ). The secondaryAZURE_FUNCTIONS_ENVIRONMENT === 'Production'guard was moot. Nothing else called the sync endpoint on a schedule, sogym_calendarwas never refreshed.Fix
Drive the sync externally, keeping all code in this repo (chosen approach: GitHub Actions cron + machine auth):
sportySync.js; replaced with a comment documenting the platform limitation..github/workflows/sporty-sync.yml— scheduled cron at 04:00, 11:00, 14:00, 22:00 UTC (+workflow_dispatch) thatPOSTs to/api/sporty-syncwith{"daysBack": 7}(self-healing lookback), with curl retries.POST /api/sporty-syncnow accepts machine auth —X-Api-Key: <SPORTY_SYNC_API_KEY>for automation, in addition to the existingX-Supabase-TokenJWT for manual kicks from a signed-in user. The fetch/parse/upsert logic was already correct and is unchanged.Setup required before this works
Add two GitHub Actions repository secrets:
SPORTY_SYNC_URLhttps://workout.umulig.org/api/sporty-syncSPORTY_SYNC_API_KEYSPORTY_SYNC_API_KEYapp setting already configured in AzureThen trigger once manually via Actions → Sporty sync → Run workflow to backfill, and verify with
GET /api/sporty-health.Docs
package.json→ 1.5.17Verification
npm test→ 92 passed ·npm run lint→ cleansporty.no); logic paths are unchanged from the previously working sync.🤖 Generated with Claude Code
https://claude.ai/code/session_01FwvkU2RBksppoWttDEcfB1
Generated by Claude Code