diff --git a/.github/workflows/openapi_deploy.yml b/.github/workflows/openapi_deploy.yml index f58daaa13d6..d8badf2bf40 100644 --- a/.github/workflows/openapi_deploy.yml +++ b/.github/workflows/openapi_deploy.yml @@ -17,6 +17,7 @@ jobs: image: node:24-alpine permissions: contents: write + actions: write steps: - name: Checkout main uses: actions/checkout@v7 @@ -46,10 +47,29 @@ jobs: cp -r main/docs/openapi/dist/. gh-pages/openapi/ - name: Commit and push + id: commit working-directory: gh-pages run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add openapi - git diff --cached --quiet && echo "No changes to publish" || \ - (git commit -m "Update openapi docs from ${GITHUB_SHA}" && git push) + if git diff --cached --quiet; then + echo "No changes to publish" + echo "changed=false" >> "$GITHUB_OUTPUT" + else + git commit -m "Update openapi docs from ${GITHUB_SHA}" + git push + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Trigger Pages deployment + if: steps.commit.outputs.changed == 'true' + uses: actions/github-script@v7 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'deploy_v3_docs.yml', + ref: 'gh-pages', + });