1
1
# See: https://getbootstrap.com/docs/5.3/customize/color/#all-colors
2
2
3
3
actions :
4
- - name : Warn if the Merge Request haven't had commit activity for 21 days and will be closed
4
+ # NOTE: depends on the "stale" label further down in the document
5
+ - name : " Warn if the Merge Request haven't had commit activity for 21 days and will be closed"
5
6
if : |1
6
- merge_request.state != "closed"
7
- && merge_request.time_since_last_commit > duration("21d ")
8
- && merge_request.time_since_last_commit < duration("28d ")
9
- && not merge_request.has_label("do-not-close ")
7
+ merge_request.state_is("opened")
8
+ && merge_request.has_no_label("stale ")
9
+ && merge_request.has_no_label("do-not-close ")
10
+ && merge_request.has_no_user_activity_within("21d ")
10
11
then :
12
+ - action : add_label
13
+ name : stale
14
+
11
15
- action : comment
12
16
message : |
13
17
:wave: Hello!
14
18
15
- This Merge Request has not seen any commit activity for 21 days.
16
- We will automatically close the Merge request after 28 days to keep our project clean .
19
+ This MR has not seen any commit activity for 21 days.
20
+ We will automatically close the MR after 28 days.
17
21
18
- To disable this behavior, add the `do-not-close` label to the Merge Request in the right menu or add a comment with `/label ~"do-not-close"`.
22
+ To disable this behavior, add the `do-not-close` label to the
23
+ MR in the right menu or add comment with `/label ~"do-not-close"`
19
24
20
- - name : Close the Merge Request if it haven't had commit activity for 28 days
25
+ # NOTE: depends on the "stale" label further down in the document
26
+ - name : " Close the Merge Request if it haven't had commit activity for 28 days"
21
27
if : |1
22
- merge_request.state != "closed"
23
- && merge_request.time_since_last_commit > duration("28d")
24
- && not merge_request.has_label("do-not-close")
28
+ merge_request.state_is("opened")
29
+ && merge_request.has_label("stale")
30
+ && merge_request.has_no_label("do-not-close")
31
+ && merge_request.has_no_activity_within("7d")
25
32
then :
26
33
- action : close
34
+
27
35
- action : comment
28
36
message : |
29
37
:wave: Hello!
30
38
31
- This Merge Request has not seen any commit activity for 28 days.
39
+ This MR has not seen any commit activity for 28 days.
32
40
To keep our project clean, we will close the Merge request now.
33
41
34
- To disable this behavior, add the `do-not-close` label to the Merge Request in the right menu or add a comment with `/label ~"do-not-close"`.
42
+ To disable this behavior, add the `do-not-close` label to the
43
+ MR in the right menu or add comment with `/label ~"do-not-close"`
35
44
36
45
- name : Approve MR if the 'break-glass-approve' label is configured
37
46
if : |1
@@ -40,10 +49,18 @@ actions:
40
49
&& merge_request.has_label("break-glass-approve")
41
50
then :
42
51
- action : approve
52
+
43
53
- action : comment
44
54
message : " Approving the MR since it has the 'break-glass-approve' label. Talk to ITGC about this!"
45
55
46
56
label :
57
+ - name : stale
58
+ color : $red
59
+ script : |1
60
+ merge_request.state_is("opened")
61
+ && merge_request.has_no_label("do-not-close")
62
+ && merge_request.has_no_user_activity_within("21d")
63
+
47
64
- name : lang/go
48
65
color : " $indigo"
49
66
script : merge_request.modified_files("*.go")
@@ -78,32 +95,42 @@ label:
78
95
description : " Modified pkg/services files"
79
96
script : merge_request.modified_files("internal/pkg/services")
80
97
98
+ # NOTE: This label assume your GitLab supports scoped labels
99
+ # See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
81
100
- name : go::tests::missing
82
101
color : " $red"
83
102
description : " The Merge Request did NOT modify Go test files"
84
103
priority : 999
85
104
script : not merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go")
86
105
106
+ # NOTE: This label assume your GitLab supports scoped labels
107
+ # See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
87
108
- name : go::tests::OK
88
109
color : " $green"
89
110
description : " The Merge Request modified Go test files"
90
111
priority : 999
91
112
script : merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go")
92
113
114
+ # NOTE: This label assume your GitLab supports scoped labels
115
+ # See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
93
116
- name : status::age::abandoned
94
117
color : " $red"
95
118
description : " The most recent commit is older than 45 days"
96
119
priority : 999
97
120
script : merge_request.time_since_last_commit > duration("45d")
98
121
skip_if : merge_request.state in ["merged", "closed", "locked"]
99
122
123
+ # NOTE: This label assume your GitLab supports scoped labels
124
+ # See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
100
125
- name : status::age::stale
101
126
color : " $red"
102
127
description : " The most recent commit is older than 30 days"
103
128
priority : 999
104
129
script : duration("30d") < merge_request.time_since_last_commit < duration("45d")
105
130
skip_if : merge_request.state in ["merged", "closed", "locked"]
106
131
132
+ # NOTE: This label assume your GitLab supports scoped labels
133
+ # See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
107
134
- name : status::age::old
108
135
color : " $red"
109
136
description : " The most recent commit is older than 14 days"
0 commit comments