File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,48 @@ name: Label new PRs
2
2
3
3
on :
4
4
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
5
+ # The `pull_request_target` event is used for "normal" PRs to label them when they are opened.
6
+ # This will use the `labeler.yml` file in the default (master) branch of the repo.
5
7
pull_request_target :
6
8
types :
7
9
- opened
8
10
- ready_for_review
9
11
12
+ # The `pull_request` event is used for PRs which change the files which handle the labeling to prevent a silently failing action.
13
+ # This will use the `labeler.yml` file in the PR branch.
14
+ pull_request :
15
+ paths :
16
+ - ' .github/workflows/label-new-prs.yml'
17
+ - ' .github/labeler.yml'
18
+
10
19
jobs :
11
20
label-new-prs :
12
21
runs-on : ubuntu-latest
22
+ if : github.repository_owner == 'PHPCSStandards' && github.event_name == 'pull_request_target'
23
+
24
+ name : Add labels to new PRs
25
+
26
+ steps :
27
+ - name : Label new PRs
28
+ uses : srvaroa/labeler@master
29
+ env :
30
+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
31
+
32
+ validate-labeler-worflow :
33
+ runs-on : ubuntu-latest
34
+ if : github.repository_owner == 'PHPCSStandards' && github.event_name == 'pull_request' && github.event.pull_request.merged == false
35
+
36
+ name : Validate changes to Labeler logic
13
37
14
38
steps :
15
- - uses : srvaroa/labeler@master
39
+ # Checkout is needed to use the `use_local_config` option.
40
+ - name : Checkout code
41
+ uses : actions/checkout@v3
42
+
43
+ - name : Verify changes to the labeling logic
44
+ uses : srvaroa/labeler@master
45
+ with :
46
+ use_local_config : true
47
+ fail_on_error : true
16
48
env :
17
49
GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
You can’t perform that action at this time.
0 commit comments