Script Functions¶
The Expr Language Definition is a great resource to learn more about the language
merge_request¶
merge_request.state_is(string...) -> boolean¶
Check if the merge_request state is any of the provided states
Valid options:
closed- In closed statelocked- Discussion has been lockedmerged- Merge request has been mergedopened- Opened merge request
merge_request.state_is_not(string...) -> boolean¶
Check if the merge_request state is NOT any of the provided states
Valid options:
closed- In closed statelocked- Discussion has been lockedmerged- Merge request has been mergedopened- Opened merge request
merge_request.has_user_activity_within(duration|string...) -> boolean¶
This function EXCLUDE changes made by scm-engine and other bots, use merge_request.has_no_activity_within if you want to include those
Return wether any user activity has happened with the provided duration.
User is defined as, all users except:
- The account that
scm-engineis running as. - Other accounts marked as
botin their profile.
Activity is defined as:
- Commits pushed to the Merge Request branch.
- Comments on the Merge Request itself (e.g. reviews and comments).
merge_request.has_no_user_activity_within(duration|string...) -> boolean¶
This function EXCLUDE changes made by scm-engine and other bots, use merge_request.has_no_activity_within if you want to exclude those
Return wether no user activity has happened with the provided duration.
User is defined as, all users except:
- The account that
scm-engineis running as. - Other accounts marked as
botin their profile.
Activity is defined as:
- Commits pushed to the Merge Request branch.
- Comments on the Merge Request itself (e.g. reviews and comments).
merge_request.has_no_user_activity_within("7d")
merge_request.has_no_user_activity_within(duration("7d"))
merge_request.has_activity_within(duration|string...) -> boolean¶
This function INCLUDE changes made by scm-engine and other bots, use merge_request.has_user_activity_within if you want to include those
Return wether any activity has happened with the provided duration, including bots and the scm-engine account.
Activity is defined as:
- Commits pushed to the Merge Request branch.
- Comments on the Merge Request itself (e.g. reviews and comments).
merge_request.has_no_activity_within(duration|string...) -> boolean¶
This function INCLUDE changes made by scm-engine and other bots, use merge_request.has_no_user_activity_within if you want to exclude those
Return wether no activity has happened with the provided duration, including bots and the scm-engine account.
Activity is defined as:
- Commits pushed to the Merge Request branch.
- Comments on the Merge Request itself (e.g. reviews and comments).
merge_request.modified_files(string...) -> boolean¶
Returns wether any of the provided files patterns have been modified in the Merge Request.
The file patterns use the .gitignore format.
merge_request.modified_files_list(string...) -> []string¶
Returns an array of files matching the provided (optional) pattern thas has been modified in the Merge Request.
The file patterns use the .gitignore format.
merge_request.has_label(string) -> boolean¶
Returns wether any of the provided label exist on the Merge Request.
merge_request.labels = ["hello"]
merge_request.has_label("hello") == true
merge_request.has_label("world") == false
merge_request.has_no_label(string) -> boolean¶
Returns wether the merge request has the provided label or not.
merge_request.labels = ["hello"]
merge_request.has_no_label("hello") == false
merge_request.has_no_label("world") == true
Global¶
duration(string) -> duration¶
Returns the time.Duration value of the given string str.
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d" and "w".
since(time.Time) -> duration¶
Returns the time.Duration value since the provided time.
uniq([]string) -> []string¶
Returns a new array where all duplicate values has been removed.
filepath_dir¶
filepath_dir returns all but the last element of path, typically the path's directory. After dropping the final element,
Dir calls Clean on the path and trailing slashes are removed.
If the path is empty, filepath_dir returns ".". If the path consists entirely of separators, filepath_dir returns a single separator.
The returned path does not end in a separator unless it is the root directory.
limit_path_depth_to¶
limit_path_depth_to takes a path structure, and limits it to the configured maximum depth. Particularly useful when using generated labels from a directory structure, and want to to have a label naming scheme that only uses path of the path.