You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+143-76
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,39 @@
7
7
>
8
8
> 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.
@@ -84,11 +117,11 @@ These keys are shared between the `conditional` and `generate` label strategy. (
84
117
85
118
#### `label.name`
86
119
87
-
* When using `label.strategy: conditional`
120
+
-When using `label.strategy: conditional`
88
121
89
122
**REQUIRED** The `name` of the label to create.
90
123
91
-
* When using `label.strategy: generate`
124
+
-When using `label.strategy: generate`
92
125
93
126
**OMITTED** The `name` field must not be set when using the `generate` strategy.
94
127
@@ -105,11 +138,11 @@ Depending on the `label.strategy` used, the behavior of the script changes, read
105
138
106
139
SCM Engine supports two strategies for managing labels, each changes the behavior of the `script`.
107
140
108
-
* `conditional` (default, if `type` key is omitted), where you provide the `name` of the label, and a `script` that returns a boolean for wether the label should be added to the Merge Request.
141
+
-`conditional`(default, if `type` key is omitted), where you provide the `name` of the label, and a `script` that returns a boolean for wether the label should be added to the Merge Request.
109
142
110
143
The `script` must return a `boolean` value, where `true` mean `add the label` and `false` mean `remove the label`.
111
144
112
-
* `generate`, where your `script` generates the list of labels that should be added to the Merge Request.
145
+
-`generate`, where your `script` generates the list of labels that should be added to the Merge Request.
113
146
114
147
The `script` must return a `list of strings`, where each label returned will be added to the Merge Request.
115
148
@@ -152,11 +185,11 @@ label:
152
185
script: merge_request.modified_files("*_test.go")
153
186
```
154
187
155
-
###### `label.strategy: generate` use-cases
188
+
##### `label.strategy: generate` use-cases
156
189
157
190
Use the `generate` strategy if you want to manage dynamic labels, for example, depending on the file structure within your project.
158
191
159
-
###### `label.strategy: generate` examples
192
+
##### `label.strategy: generate` examples
160
193
161
194
> The `script` field is a [expr-lang](https://expr-lang.org/) expression, a safe, fast, and intuitive expression evaluator.
162
195
@@ -232,82 +265,116 @@ The `skip_if` field must be a valid [Expr-lang](https://expr-lang.org/) expressi
232
265
> Missing an attribute? The `pkg/scm/gitlab/context_*` files are what is used to query GitLab, adding the missing `field` to the right `struct` should make it accessible.
233
266
> Please open an issue or Pull Request if something is missing.
234
267
268
+
> [!IMPORTANT]
269
+
> _SCM Engine uses [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) for fields instead of [`camelCase`](https://en.wikipedia.org/wiki/Camel_case)_
270
+
235
271
The following attributes are available in `script` fields.
236
272
237
273
They can be accessed exactly as shown in this list.
238
274
239
-
#### Project
275
+
#### project
240
276
241
277
> [!NOTE]
242
-
> See the GitLab GraphQL [`Project`](https://docs.gitlab.com/ee/api/graphql/reference/#project), [`Group`](https://docs.gitlab.com/ee/api/graphql/reference/#group), [`MergeRequest`](https://docs.gitlab.com/ee/api/graphql/reference/#mergerequest), [`Label`](https://docs.gitlab.com/ee/api/graphql/reference/#label), and [`Commit`](https://docs.gitlab.com/ee/api/graphql/reference/#commit) GraphQL resource for more details about the fields.
243
-
>
244
-
> _Note that we use [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) for fields instead of [`camelCase`](https://en.wikipedia.org/wiki/Camel_case)_
The `duration()` between `now()` and the last commit in the Merge Request.
305
-
* `merge_request.title` (string)
306
-
* `merge_request.updated_at` (time)
278
+
> See the [GitLab GraphQL `Project` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#project) for more details about the fields.
279
+
280
+
- `project.archived`(boolean)
281
+
- `project.created_at`(time)
282
+
- `project.description`(string)
283
+
- `project.full_path`(string)
284
+
- `project.id`(string)
285
+
- `project.last_activity_at`(time)
286
+
- `project.name_with_namespace`(string)
287
+
- `project.name`(string)
288
+
- `project.path`(string)
289
+
- `project.topics[]`(array of string)
290
+
- `project.updated_at`(time)
291
+
- `project.visibility`(string)
292
+
293
+
#### project.labels
294
+
295
+
> [!NOTE]
296
+
> See the [GitLab GraphQL `Label` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#label) for more details about the fields.
297
+
298
+
- `project.labels[].color`(string)
299
+
- `project.labels[].description`(string)
300
+
- `project.labels[].id`(string)
301
+
- `project.labels[].title`(string)
302
+
303
+
#### group
304
+
305
+
> See the [GitLab GraphQL `Group` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#group) for more details about the fields.
306
+
307
+
- `group.description`(string)
308
+
- `group.id`(string)
309
+
- `group.name`(string)
310
+
311
+
#### merge_request
312
+
313
+
> See the [GitLab GraphQL `MergeRequest` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#mergerequest) for more details about the fields.
- `merge_request.time_between_first_and_last_commit`(duration) - SCM Engine - The `duration()` between the first and last commit in the Merge Request.
339
+
- `merge_request.time_since_first_commit`(duration) - SCM Engine - The `duration()` between `now()` and the first commit in the Merge Request.
340
+
- `merge_request.time_since_last_commit`(duration) - SCM Engine - The `duration()` between `now()` and the last commit in the Merge Request.
341
+
- `merge_request.title`(string)
342
+
- `merge_request.updated_at`(time)
343
+
344
+
#### merge_request.diff_stats
345
+
346
+
> See the [GitLab GraphQL `DiffStats` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#diffstats) for more details about the fields.
347
+
348
+
- `merge_request.diff_stats[].additions`(int)
349
+
- `merge_request.diff_stats[].deletions`(int)
350
+
- `merge_request.diff_stats[].path`(string)
351
+
352
+
#### merge_request.first_commit
353
+
354
+
> See the [GitLab GraphQL `Commit` GraphQL resource](https://docs.gitlab.com/ee/api/graphql/reference/#commit) for more details about the fields.
0 commit comments