Files
loldle/data/.github/workflows/update-champions.yml
T
tiennm99 80bbf3a641 ci: dispatch miti99bot sync event after champions update
After a successful commit of champions.json, send a repository_dispatch
(type: loldle-data-updated) to tiennm99/miti99bot so its sync workflow
pulls the latest data into its loldle module. No-op when
MITI99BOT_DISPATCH_TOKEN is unset.
2026-04-20 17:10:28 +07:00

53 lines
1.6 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
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run scraper
run: go run .
- name: Commit and push if changed
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add champions.json
if git diff --cached --quiet; then
echo "No changes to commit"
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git commit -m "chore: update champions data to latest patch"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Notify miti99bot
if: steps.commit.outputs.changed == 'true' && env.MITI99BOT_DISPATCH_TOKEN != ''
env:
MITI99BOT_DISPATCH_TOKEN: ${{ secrets.MITI99BOT_DISPATCH_TOKEN }}
run: |
curl -fsSL -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $MITI99BOT_DISPATCH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/tiennm99/miti99bot/dispatches \
-d '{"event_type":"loldle-data-updated","client_payload":{"source":"loldle-data","sha":"${{ github.sha }}"}}'