@@ -2,15 +2,26 @@ name: Configure PR When PR Opened
2
2
3
3
on :
4
4
pull_request :
5
- types :
6
- - opened
5
+ types : ["opened", "edited"]
7
6
8
7
permissions :
9
8
contents : read
10
9
11
10
jobs :
11
+ check-title :
12
+ name : Check PR Title
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Check PR title
17
+ uses : deepakputhraya/action-pr-title@master
18
+ with :
19
+ regex : ' ((Be|Fe|Devops|Be,fe|Fe,be)\/(feature|bugfix|hotfix|refactor)(,(feature|bugfix|hotfix|refactor))*\/#[\d]+( #[\d]+)*.+|release v[\d]+\.[\d]+\.[\d]+)'
20
+ github_token : ${{ secrets.ADD_TO_PROJECT_PAT }}
21
+
12
22
set-label :
13
23
name : Set Labels to PR
24
+ needs : check-title
14
25
runs-on : ubuntu-latest
15
26
permissions :
16
27
contents : read
@@ -24,23 +35,25 @@ jobs:
24
35
25
36
set-issue :
26
37
name : Set Issue to PR
38
+ needs : check-title
27
39
runs-on : ubuntu-latest
28
40
29
41
steps :
30
42
- uses : actions/github-script@v7
43
+ if : github.event.pull_request.base.ref != 'release'
31
44
with :
32
45
github-token : ${{ secrets.ADD_TO_PROJECT_PAT }}
33
46
script : |
34
47
const prTitle = context.payload.pull_request.title;
35
48
const issueNumbers = prTitle.match(/#(\d+)/g);
36
- const prefix = issueNumbers ? issueNumbers.reduce((acc, curr) => `${acc} ${curr}`, "resolved ") : '';
37
- const body = context.payload.pull_request.body.replace(/🔮 resolved #( \d+)( #(\d+))* /g, '');
49
+ const prefix = issueNumbers ? issueNumbers.reduce((acc, curr) => `${acc}🔮 resolved ${curr}\n `, "") : '';
50
+ const body = context.payload.pull_request.body.replace(/( 🔮 resolved #\d+)+ /g, '');
38
51
39
52
github.rest.pulls.update({
40
53
owner: context.repo.owner,
41
54
repo: context.repo.repo,
42
55
pull_number: context.payload.number,
43
- body: `🔮 ${prefix}\n ${body}`,
56
+ body: `${prefix}${body}`,
44
57
});
45
58
46
59
issueNumbers?.forEach((num) => {
58
71
59
72
steps :
60
73
- uses : actions/github-script@v7
74
+ if : github.event.pull_request.base.ref != 'release'
61
75
with :
62
76
github-token : ${{ secrets.ADD_TO_PROJECT_PAT }}
63
77
script : |
0 commit comments