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
22
33on :
44 # 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.
57 pull_request_target :
68 types :
79 - opened
810 - ready_for_review
911
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+
1019jobs :
1120 label-new-prs :
1221 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
1337
1438 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
1648 env :
1749 GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
You can’t perform that action at this time.
0 commit comments