From d9c714831a320be155e57cc828ec4a135eb6e457 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 20 Apr 2026 17:10:28 +0700 Subject: [PATCH] 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. --- .github/workflows/update-champions.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-champions.yml b/.github/workflows/update-champions.yml index 325385c..5df8040 100644 --- a/.github/workflows/update-champions.yml +++ b/.github/workflows/update-champions.yml @@ -25,10 +25,28 @@ jobs: 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 - git diff --cached --quiet && echo "No changes to commit" && exit 0 + 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 }}"}}'