|
2 | 2 |
|
3 | 3 | actions:
|
4 | 4 | - name: Warn that the ticket if older than 30 days
|
5 |
| - if: merge_request.state != "closed" && merge_request.time_since_last_commit > duration("30d") && not merge_request.has_label("do-not-close") |
| 5 | + if: | |
| 6 | + // ignore MRs already closed |
| 7 | + merge_request.state != "closed" |
| 8 | + // if last commit happened more than 30 days ago |
| 9 | + && merge_request.time_since_last_commit > duration("30d") |
| 10 | + // but still less than 45 days ago (where we close the MR) |
| 11 | + && merge_request.time_since_last_commit < duration("45d") |
| 12 | + // and the label to disable this feature is not on the MR |
| 13 | + && not merge_request.has_label("do-not-close") |
6 | 14 | then:
|
7 | 15 | - action: comment
|
8 |
| - message: "Hey, this MR is old, we will close it in 15 days if no activity has happened. If you want to disable this behavior, add the label 'do-not-close' on the MR." |
| 16 | + message: | |
| 17 | + Hello! |
| 18 | +
|
| 19 | + This Merge Request have not seen any commit activity for 30 days. In an effort to keep our project clean we will automatically close the Merge request after 45 days. |
| 20 | +
|
| 21 | + You can add the "do-not-close" label to the Merge Request to disable this behavior. |
9 | 22 |
|
10 | 23 | - name: Close ticket if older than 45 days
|
11 |
| - if: merge_request.state != "closed" && merge_request.time_since_last_commit > duration("45d") && not merge_request.has_label("do-not-close") |
| 24 | + if: | |
| 25 | + merge_request.state != "closed" |
| 26 | + && merge_request.time_since_last_commit > duration("45d") |
| 27 | + && not merge_request.has_label("do-not-close") |
12 | 28 | then:
|
13 | 29 | - action: close
|
14 | 30 | - action: comment
|
15 |
| - message: "As promised, we're closing the MR due to inactivity, bye bye" |
| 31 | + message: | |
| 32 | + Hello! |
| 33 | +
|
| 34 | + This Merge Request have not seen any commit activity for 45 days. In an effort to keep our project clean we will automatically close the Merge request. |
| 35 | +
|
| 36 | + You can add the "do-not-close" label to the Merge Request to disable this behavior. |
16 | 37 |
|
17 | 38 | - name: Approve MR if the 'break-glass-approve' label is configured
|
18 |
| - if: merge_request.state != "closed" && not merge_request.approved && merge_request.has_label("break-glass-approve") |
| 39 | + if: | |
| 40 | + merge_request.state != "closed" |
| 41 | + && not merge_request.approved |
| 42 | + && merge_request.has_label("break-glass-approve") |
19 | 43 | then:
|
20 | 44 | - action: approve
|
21 | 45 | - action: comment
|
|
0 commit comments