|
1 |
| -# About |
| 1 | +# SCM-Engine |
2 | 2 |
|
3 | 3 | > [!NOTE]
|
4 | 4 | > SCM Engine allow for easy Merge Request automation within your GitLab projects.
|
|
8 | 8 | >
|
9 | 9 | > SCM engine can be run either as a regular CI job in your pipeline, or be triggered through the Webhook system, allowing for versatile and flexible deployments.
|
10 | 10 |
|
11 |
| -## Documentation |
| 11 | +## Example |
12 | 12 |
|
13 | 13 | > [!TIP]
|
| 14 | +> Want to see what `scm-engine` can do? [Check out the *examples* page for real-world use-cases](https://jippi.github.io/scm-engine/configuration/examples/), with in-depth explanations and turn-key usage patterns. |
| 15 | +
|
| 16 | +## Documentation |
| 17 | + |
| 18 | +> [!IMPORTANT] |
14 | 19 | > Please see [the documentation site](https://jippi.github.io/scm-engine/) for in-depth information
|
15 | 20 | >
|
16 | 21 | > * [Installation](https://jippi.github.io/scm-engine/install/)
|
|
27 | 32 | > * [Getting started](https://jippi.github.io/scm-engine/gitlab/setup/)
|
28 | 33 | > * [Script attributes](https://jippi.github.io/scm-engine/gitlab/script-attributes/)
|
29 | 34 | > * [Script functions](https://jippi.github.io/scm-engine/gitlab/script-functions/)
|
30 |
| -
|
31 |
| -## Example |
32 |
| - |
33 |
| -```yaml |
34 |
| -# See: https://getbootstrap.com/docs/5.3/customize/color/#all-colors |
35 |
| - |
36 |
| -actions: |
37 |
| - - name: Warn if the Merge Request haven't had commit activity for 21 days and will be closed |
38 |
| - if: |1 |
39 |
| - merge_request.state != "closed" |
40 |
| - && merge_request.time_since_last_commit > duration("21d") |
41 |
| - && merge_request.time_since_last_commit < duration("28d") |
42 |
| - && not merge_request.has_label("do-not-close") |
43 |
| - then: |
44 |
| - - action: comment |
45 |
| - message: | |
46 |
| - :wave: Hello! |
47 |
| -
|
48 |
| - This Merge Request has not seen any commit activity for 21 days. |
49 |
| - We will automatically close the Merge request after 28 days to keep our project clean. |
50 |
| -
|
51 |
| - 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"`. |
52 |
| -
|
53 |
| - - name: Close the Merge Request if it haven't had commit activity for 28 days |
54 |
| - if: |1 |
55 |
| - merge_request.state != "closed" |
56 |
| - && merge_request.time_since_last_commit > duration("28d") |
57 |
| - && not merge_request.has_label("do-not-close") |
58 |
| - then: |
59 |
| - - action: close |
60 |
| - - action: comment |
61 |
| - message: | |
62 |
| - :wave: Hello! |
63 |
| -
|
64 |
| - This Merge Request has not seen any commit activity for 28 days. |
65 |
| - To keep our project clean, we will close the Merge request now. |
66 |
| -
|
67 |
| - 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"`. |
68 |
| -
|
69 |
| - - name: Approve MR if the 'break-glass-approve' label is configured |
70 |
| - if: |1 |
71 |
| - merge_request.state != "closed" |
72 |
| - && not merge_request.approved |
73 |
| - && merge_request.has_label("break-glass-approve") |
74 |
| - then: |
75 |
| - - action: approve |
76 |
| - - action: comment |
77 |
| - message: "Approving the MR since it has the 'break-glass-approve' label. Talk to ITGC about this!" |
78 |
| - |
79 |
| -label: |
80 |
| - - name: lang/go |
81 |
| - color: "$indigo" |
82 |
| - script: merge_request.modified_files("*.go") |
83 |
| - |
84 |
| - - name: lang/markdown |
85 |
| - color: "$indigo" |
86 |
| - description: "Modified MarkDown files" |
87 |
| - script: merge_request.modified_files("*.md") |
88 |
| - |
89 |
| - - name: dependencies/go |
90 |
| - color: "$orange" |
91 |
| - description: "Updated Go dependency files like go.mod and go.sum" |
92 |
| - script: merge_request.modified_files("go.mod", "go.sum") |
93 |
| - |
94 |
| - - name: type/ci |
95 |
| - color: "$green" |
96 |
| - description: "Modified CI files" |
97 |
| - script: merge_request.modified_files(".gitlab-ci.yml") || merge_request.modified_files("build/") |
98 |
| - |
99 |
| - - name: type/deployment |
100 |
| - color: "$green" |
101 |
| - description: "Modified Deployment files" |
102 |
| - script: merge_request.modified_files("_infrastructure/", "scripts/", "configs/") |
103 |
| - |
104 |
| - - name: type/documentation |
105 |
| - color: "$green" |
106 |
| - description: "Modified Documentation files" |
107 |
| - script: merge_request.modified_files("docs/") |
108 |
| - |
109 |
| - - name: type/services |
110 |
| - color: "$green" |
111 |
| - description: "Modified pkg/services files" |
112 |
| - script: merge_request.modified_files("internal/pkg/services") |
113 |
| - |
114 |
| - - name: go::tests::missing |
115 |
| - color: "$red" |
116 |
| - description: "The Merge Request did NOT modify Go test files" |
117 |
| - priority: 999 |
118 |
| - script: not merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go") |
119 |
| - |
120 |
| - - name: go::tests::OK |
121 |
| - color: "$green" |
122 |
| - description: "The Merge Request modified Go test files" |
123 |
| - priority: 999 |
124 |
| - script: merge_request.modified_files("*_test.go") && merge_request.modified_files("*.go") |
125 |
| - |
126 |
| - - name: status::age::abandoned |
127 |
| - color: "$red" |
128 |
| - description: "The most recent commit is older than 45 days" |
129 |
| - priority: 999 |
130 |
| - script: merge_request.time_since_last_commit > duration("45d") |
131 |
| - skip_if: merge_request.state in ["merged", "closed", "locked"] |
132 |
| - |
133 |
| - - name: status::age::stale |
134 |
| - color: "$red" |
135 |
| - description: "The most recent commit is older than 30 days" |
136 |
| - priority: 999 |
137 |
| - script: duration("30d") < merge_request.time_since_last_commit < duration("45d") |
138 |
| - skip_if: merge_request.state in ["merged", "closed", "locked"] |
139 |
| - |
140 |
| - - name: status::age::old |
141 |
| - color: "$red" |
142 |
| - description: "The most recent commit is older than 14 days" |
143 |
| - priority: 999 |
144 |
| - script: duration("14d") < merge_request.time_since_last_commit < duration("30d") |
145 |
| - skip_if: merge_request.state in ["merged", "closed", "locked"] |
146 |
| - |
147 |
| - # generate labels for services |
148 |
| - # |
149 |
| - # internal/service/vault/client.go |
150 |
| - # => |
151 |
| - # service/vault |
152 |
| - - strategy: generate |
153 |
| - description: "Modified this a service directory" |
154 |
| - color: "$pink" |
155 |
| - script: > |
156 |
| - merge_request.modified_files_list("internal/service/") |
157 |
| - | map({ filepath_dir(#) }) |
158 |
| - | map({ trimPrefix(#, "internal/") }) |
159 |
| - | uniq() |
160 |
| -
|
161 |
| - # generate labels for commands |
162 |
| - # |
163 |
| - # internal/app/my-command/subcommands/aws/login/login.go |
164 |
| - # => |
165 |
| - # command/aws/login |
166 |
| - - strategy: generate |
167 |
| - description: "Modified this my-command command" |
168 |
| - color: "$purple" |
169 |
| - script: > |
170 |
| - merge_request.modified_files_list("internal/app/my-command/subcommands/") |
171 |
| - | map({ filepath_dir(#) }) |
172 |
| - | map({ trimPrefix(#, "internal/app/my-command/subcommands/") }) |
173 |
| - | map({ string("command/" + #) }) |
174 |
| - | uniq() |
175 |
| -``` |
0 commit comments