use github cli

This commit is contained in:
Alex Holliday
2025-06-01 11:47:13 -07:00
parent 59f1ce7d31
commit 4241758354
+14 -11
View File
@@ -40,17 +40,20 @@ jobs:
working-directory: server
run: npm run format-check
close-pr-if-needed:
if: always()
runs-on: ubuntu-latest
needs: [format-client, format-server]
if: |
always() && (
needs.format-client.result == 'failure' ||
needs.format-server.result == 'failure'
)
steps:
- name: Close PR
uses: peter-evans/close-pull@v3
with:
comment: |
❌ Formatting check failed — PR auto-closed.
Please run `npm run format` and push again.
- name: Get PR URL
id: pr
run: echo "PR_URL=$(jq -r .pull_request.url "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
- name: Close PR using GitHub CLI
if: |
needs.format-client.result == 'failure' ||
needs.format-server.result == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr close "$PR_URL" --delete-branch --comment "❌ Formatting check failed — PR auto-closed.
Please run \`npm run format\` and push again."