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 }}"}}'