1
- name : Feature Branch Pull Request
1
+ name : PR Generator CI
2
2
on :
3
3
push :
4
4
branches-ignore :
@@ -19,12 +19,15 @@ jobs:
19
19
? "✨ "
20
20
: context.payload.ref.startsWith("refs/heads/hotfix")
21
21
? "🚑 "
22
+ : context.payload.ref.startsWith("refs/heads/bug")
23
+ ? "🐛 "
22
24
: "";
23
25
return `${emoji}${capitalize(
24
26
context.payload.ref
25
27
.replace("refs/heads/", "")
26
28
.replace(/-/g, " ")
27
29
.replace("feature ", "")
30
+ .replace("bug ", "")
28
31
.replace("hotfix ", "")
29
32
)}`;
30
33
result-encoding : string
@@ -43,11 +46,28 @@ jobs:
43
46
result-encoding : string
44
47
- name : Set PR body
45
48
run : echo "PULL_REQUEST_BODY=${{steps.set-pr-body.outputs.result}}" >> $GITHUB_ENV
49
+ - name : Generate PR draft
50
+ uses : actions/github-script@v3
51
+ id : set-pr-draft
52
+ with :
53
+ script : |
54
+ return !context.payload.ref.startsWith("refs/heads/hotfix");
55
+ - name : Set PR draft
56
+ run : echo "PULL_REQUEST_DRAFT=${{steps.set-pr-draft.outputs.result}}" >> $GITHUB_ENV
57
+ - name : Determine whether to merge
58
+ uses : actions/github-script@v3
59
+ id : should-pr
60
+ with :
61
+ github-token : ${{ secrets.GH_PAT }}
62
+ script : |
63
+ return
64
+ context.payload.ref.startsWith("refs/heads/feature") ||
65
+ context.payload.ref.startsWith("refs/heads/hotfix") ||
66
+ context.payload.ref.startsWith("refs/heads/bug");
46
67
- name : pull-request-action
47
-
68
+
69
+ if : always() && steps.should-pr.outputs.result
48
70
env :
49
71
GITHUB_TOKEN : ${{ secrets.GH_PAT }}
50
- BRANCH_PREFIX : " feature-"
51
72
PULL_REQUEST_BRANCH : " master"
52
73
PULL_REQUEST_REVIEWERS : " AnandChowdhary"
53
- PULL_REQUEST_DRAFT : true
0 commit comments