Skip to content

Get Leaderboard Endpoint (#232) #34

Get Leaderboard Endpoint (#232)

Get Leaderboard Endpoint (#232) #34

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',
})