diff --git a/.github/workflows/openapi-decorate.yml b/.github/workflows/openapi-decorate.yml index 9c38e2900b..ad6c9648da 100644 --- a/.github/workflows/openapi-decorate.yml +++ b/.github/workflows/openapi-decorate.yml @@ -53,6 +53,21 @@ jobs: - name: Decorate the dereferenced OpenAPI schemas run: script/rest/update-files.js --decorate-only + - name: Check if pull request should be closed + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + run: | + echo "If there are no changes, exit" + NUM_FILES_CHANGED=$(git diff --name-only -- lib/rest/static/decorated | wc -l) + if [[ $NUM_FILES_CHANGED -eq 0 ]] + then + echo "No decorated file changes found" + gh pr comment "$PR_URL" --body "🤖 This pull request has no changes to lib/rest/static/decorated, so it is being closed automatically." + gh pr close "$PR_URL" + exit 0 + fi + - name: Check in the decorated files uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192 with: