use github cli
This commit is contained in:
1 parent
59f1ce7d31
commit
4241758354
1 file changed
+14
-11
@@ -40,17 +40,20 @@ jobs:
|
|||||||
working-directory: server
|
working-directory: server
|
||||||
run: npm run format-check
|
run: npm run format-check
|
||||||
close-pr-if-needed:
|
close-pr-if-needed:
|
||||||
|
if: always()
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [format-client, format-server]
|
needs: [format-client, format-server]
|
||||||
if: |
|
|
||||||
always() && (
|
|
||||||
needs.format-client.result == 'failure' ||
|
|
||||||
needs.format-server.result == 'failure'
|
|
||||||
)
|
|
||||||
steps:
|
steps:
|
||||||
- name: Close PR
|
- name: Get PR URL
|
||||||
uses: peter-evans/close-pull@v3
|
id: pr
|
||||||
with:
|
run: echo "PR_URL=$(jq -r .pull_request.url "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
|
||||||
comment: |
|
|
||||||
❌ Formatting check failed — PR auto-closed.
|
- name: Close PR using GitHub CLI
|
||||||
Please run `npm run format` and push again.
|
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."
|
||||||
Reference in new issue
Block a user