Skip to content

Commit 6321312

Browse files
committed
doc: add actions example
1 parent 6383e65 commit 6321312

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,39 @@ The file path can be changed via `--config` CLI flag and `$SCM_ENGINE_CONFIG_FIL
183183
> The `script` field is a [expr-lang](https://expr-lang.org/) expression, a safe, fast, and intuitive expression evaluator.
184184

185185
```yaml
186+
actions:
187+
- name: Warn if the Merge Request haven't had commit activity for 21 days and will be closed
188+
if: |
189+
merge_request.state != "closed"
190+
&& merge_request.time_since_last_commit > duration("21d")
191+
&& merge_request.time_since_last_commit < duration("28d")
192+
&& not merge_request.has_label("do-not-close")
193+
then:
194+
- action: comment
195+
message: |
196+
:wave: Hello!
197+
198+
This Merge Request has not seen any commit activity for 21 days.
199+
We will automatically close the Merge request after 28 days to keep our project clean.
200+
201+
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"`.
202+
203+
- name: Close the Merge Request if it haven't had commit activity for 28 days
204+
if: |
205+
merge_request.state != "closed"
206+
&& merge_request.time_since_last_commit > duration("28d")
207+
&& not merge_request.has_label("do-not-close")
208+
then:
209+
- action: close
210+
- action: comment
211+
message: |
212+
:wave: Hello!
213+
214+
This Merge Request has not seen any commit activity for 28 days.
215+
To keep our project clean, we will close the Merge request now.
216+
217+
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"`.
218+
186219
label:
187220
# Add a label named "lang/go"
188221
- name: lang/go

0 commit comments

Comments
 (0)