Skip to content

Commit 703b16a

Browse files
committed
feat(workflow): add close-pr on non-dev branch
1 parent 056d00c commit 703b16a

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/pull_format.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
name: pull format
22

3-
on: [pull_request]
4-
5-
permissions:
6-
contents: write
3+
on:
4+
pull_request_target:
5+
types: [assigned, opened, synchronize, reopened]
76

87
jobs:
8+
# This workflow closes invalid PR
9+
close-pr:
10+
name: closepr
11+
# The type of runner that the job will run on
12+
runs-on: ubuntu-latest
13+
permissions: write-all
14+
15+
# Steps represent a sequence of tasks that will be executed as part of the job
16+
steps:
17+
- name: Close PR if it is not pointed to dev branch
18+
if: github.event.pull_request.base.ref != 'dev'
19+
uses: superbrothers/close-pull-request@v3
20+
with:
21+
# Optional. Post a issue comment just before closing a pull request.
22+
comment: "Invalid PR to non-dev branch ${{ github.event.pull_request.base.ref }}."
23+
924
pull_format:
1025
runs-on: ${{ matrix.os }}
26+
permissions:
27+
contents: write
1128

1229
strategy:
1330
matrix:

0 commit comments

Comments
 (0)