mirror of
https://github.com/tiennm99/loldle-data.git
synced 2026-05-27 02:00:14 +00:00
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.
This commit is contained in:
@@ -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 }}"}}'
|
||||
|
||||
Reference in New Issue
Block a user