Files
loldle/web/.github/workflows/sync-data.yml
T
tiennm99 eae345ecbb chore: remove Next.js and repoint CI at the SvelteKit layout
sync-data.yml now writes static/champions.json. This is the edit that had to
land with the deletion of public/: the workflow reports success regardless of
which path it writes, so a miss would have left the weekly sync green while
the live game 404'd on data load.

deploy.yml publishes build/ and passes BASE_PATH. Adds ci.yml, which runs
test, lint, and build on pull_request and pushes to main -- the repo had no
PR-triggered workflow before, so 'green before merge' was previously
unenforceable.

Deletes app/, components/, lib/, public/, next.config.mjs and
postcss.config.mjs, drops the Next and React dependencies, and swaps ESLint
onto eslint-plugin-svelte. sharp and unrs-resolver left pnpm's allowBuilds
because both arrived with Next and pnpm why now reports no dependents.
2026-07-25 11:18:58 +07:00

55 lines
1.7 KiB
YAML

name: Sync champions data
on:
schedule:
# Thursdays 12:00 UTC, after loldle-data's own 06:00 UTC scrape
# (GitHub queues scheduled runs 2-4h late, so leave a wide margin)
- cron: '0 12 * * 4'
workflow_dispatch:
permissions:
contents: write
actions: write
concurrency:
group: sync-data
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
SOURCE_REPO: tiennm99/loldle-data
steps:
- uses: actions/checkout@v7
- name: Fetch champions.json from loldle-data
run: |
set -euo pipefail
sha=$(gh api "repos/$SOURCE_REPO/commits/main" --jq .sha)
gh api "repos/$SOURCE_REPO/contents/champions.json?ref=$sha" \
-H "Accept: application/vnd.github.raw" > static/champions.json
echo "SOURCE_SHA=${sha:0:7}" >> "$GITHUB_ENV"
- name: Commit if changed
id: commit
run: |
set -euo pipefail
if git diff --quiet -- static/champions.json; then
echo "static/champions.json already matches loldle-data@$SOURCE_SHA"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add static/champions.json
git commit -m "chore(data): sync champions from loldle-data@$SOURCE_SHA"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
# A push made with GITHUB_TOKEN does not trigger other workflows,
# so the Pages deploy has to be started explicitly.
- name: Trigger deploy
if: steps.commit.outputs.changed == 'true'
run: gh workflow run deploy.yml --ref main