Get Leaderboard Endpoint (#232) #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger API update | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
trigger-api-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: OpenAPI JSON changed? | |
id: openapi-check | |
run: | | |
if git diff origin/main --name-only | grep -q openapi.json; then | |
echo "found=true" >> $GITHUB_OUTPUT | |
else | |
echo "No changes to the `openapi.json` file detected" | |
exit 0 | |
fi | |
- name: Trigger API update | |
if: steps.openapi-check.outputs.found == 'true' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'leaderboardsgg', | |
repo: 'leaderboard-site', | |
workflow_id: 'update-api.yml', | |
ref: 'main', | |
}) |