Skip to content

Commit 77e2685

Browse files
committed
validate automation also closes the pr automatically
1 parent 8aedf1e commit 77e2685

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/validate-structure.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate Folder Structure
1+
name: Validate Folder Structure
22

33
on:
44
pull_request:
@@ -25,3 +25,16 @@ jobs:
2525

2626
- name: Validate folder layout
2727
run: node .github/scripts/validate-structure.js
28+
29+
- name: Close pull request on failure
30+
if: ${{ failure() && github.event_name == 'pull_request' }}
31+
uses: actions/github-script@v6
32+
with:
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
script: |
35+
await github.rest.pulls.update({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
pull_number: context.payload.pull_request.number,
39+
state: 'closed'
40+
});

0 commit comments

Comments
 (0)