ci: push champions data directly to miti99bot repo

Replaces the repository_dispatch notification flow. After a successful
champions.json commit in loldle-data, this workflow now clones
miti99bot, copies the file, regenerates champions-data.js via the
project's build script, and commits+pushes to miti99bot main.

Token secret renamed MITI99BOT_DISPATCH_TOKEN -> MITI99BOT_PUSH_TOKEN
to reflect the new scope (contents:write on tiennm99/miti99bot).
This commit is contained in:
2026-04-20 18:33:30 +07:00
parent 80bbf3a641
commit 859eff4c82
+18 -9
View File
@@ -39,14 +39,23 @@ jobs:
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Notify miti99bot
if: steps.commit.outputs.changed == 'true' && env.MITI99BOT_DISPATCH_TOKEN != ''
- name: Push to miti99bot
if: steps.commit.outputs.changed == 'true' && env.MITI99BOT_PUSH_TOKEN != ''
env:
MITI99BOT_DISPATCH_TOKEN: ${{ secrets.MITI99BOT_DISPATCH_TOKEN }}
MITI99BOT_PUSH_TOKEN: ${{ secrets.MITI99BOT_PUSH_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 }}"}}'
set -euo pipefail
git clone --depth 1 \
"https://x-access-token:${MITI99BOT_PUSH_TOKEN}@github.com/tiennm99/miti99bot.git" miti99bot
cp champions.json miti99bot/src/modules/loldle/champions.json
cd miti99bot
node scripts/build-loldle-data.js
git add src/modules/loldle/champions.json src/modules/loldle/champions-data.js
if git diff --cached --quiet; then
echo "miti99bot already up to date"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "chore(loldle): sync champions data from loldle-data@${GITHUB_SHA::7}"
git push