mirror of
https://github.com/tiennm99/loldle.git
synced 2026-10-11 03:13:42 +00:00
Workflows move to the repo root: deploy and CI build from web/, and a single update-champions workflow replaces the old two-repo pipeline (scrape in data/, copy into web/static/, redeploy). Go module becomes github.com/tiennm99/loldle/data. Root README maps the three parts.
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: Update champions data
|
|
|
|
on:
|
|
schedule:
|
|
# Every Thursday at 06:00 UTC (day after Riot's Wednesday patch)
|
|
- cron: "0 6 * * 4"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
|
|
concurrency:
|
|
group: update-champions
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: data/go.mod
|
|
|
|
- name: Run scraper
|
|
run: go run .
|
|
working-directory: data
|
|
|
|
- name: Copy data into the web app
|
|
run: cp data/champions.json web/static/champions.json
|
|
|
|
- name: Commit and push if changed
|
|
id: commit
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add data/champions.json data/CHAMPIONS.md web/static/champions.json
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
exit 0
|
|
fi
|
|
git commit -m "chore(data): update champions data to latest patch"
|
|
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
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|