Skip to content

Commit 881afb2

Browse files
committed
docs: improve landing page with examples
1 parent 6ea0353 commit 881afb2

File tree

2 files changed

+47
-14
lines changed

2 files changed

+47
-14
lines changed

.scm-engine.example.yml

+41-14
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
11
# See: https://getbootstrap.com/docs/5.3/customize/color/#all-colors
22

33
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"
56
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")
1011
then:
12+
- action: add_label
13+
name: stale
14+
1115
- action: comment
1216
message: |
1317
:wave: Hello!
1418
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.
1721
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"`
1924
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"
2127
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")
2532
then:
2633
- action: close
34+
2735
- action: comment
2836
message: |
2937
:wave: Hello!
3038
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.
3240
To keep our project clean, we will close the Merge request now.
3341
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"`
3544
3645
- name: Approve MR if the 'break-glass-approve' label is configured
3746
if: |1
@@ -40,10 +49,18 @@ actions:
4049
&& merge_request.has_label("break-glass-approve")
4150
then:
4251
- action: approve
52+
4353
- action: comment
4454
message: "Approving the MR since it has the 'break-glass-approve' label. Talk to ITGC about this!"
4555

4656
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+
4764
- name: lang/go
4865
color: "$indigo"
4966
script: merge_request.modified_files("*.go")
@@ -78,32 +95,42 @@ label:
7895
description: "Modified pkg/services files"
7996
script: merge_request.modified_files("internal/pkg/services")
8097

98+
# NOTE: This label assume your GitLab supports scoped labels
99+
# See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
81100
- name: go::tests::missing
82101
color: "$red"
83102
description: "The Merge Request did NOT modify Go test files"
84103
priority: 999
85104
script: not merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go")
86105

106+
# NOTE: This label assume your GitLab supports scoped labels
107+
# See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
87108
- name: go::tests::OK
88109
color: "$green"
89110
description: "The Merge Request modified Go test files"
90111
priority: 999
91112
script: merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go")
92113

114+
# NOTE: This label assume your GitLab supports scoped labels
115+
# See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
93116
- name: status::age::abandoned
94117
color: "$red"
95118
description: "The most recent commit is older than 45 days"
96119
priority: 999
97120
script: merge_request.time_since_last_commit > duration("45d")
98121
skip_if: merge_request.state in ["merged", "closed", "locked"]
99122

123+
# NOTE: This label assume your GitLab supports scoped labels
124+
# See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
100125
- name: status::age::stale
101126
color: "$red"
102127
description: "The most recent commit is older than 30 days"
103128
priority: 999
104129
script: duration("30d") < merge_request.time_since_last_commit < duration("45d")
105130
skip_if: merge_request.state in ["merged", "closed", "locked"]
106131

132+
# NOTE: This label assume your GitLab supports scoped labels
133+
# See: https://docs.gitlab.com/ee/user/project/labels.html#scoped-labels
107134
- name: status::age::old
108135
color: "$red"
109136
description: "The most recent commit is older than 14 days"

docs/index.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
title: About
3+
hide:
4+
- toc
35
---
46
# About scm-engine
57

@@ -15,6 +17,10 @@ title: About
1517

1618
## What does it look like?
1719

20+
!!! tip "Please see the [Configuration Examples page](configuration/examples.md) for more use-cases"
21+
22+
!!! info "Please see the [Configuration Options page](configuration/index.md) for all options and explanations"
23+
1824
```yaml
1925
--8<-- ".scm-engine.example.yml"
2026
```

0 commit comments

Comments
 (0)