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
|[`capture`](#capture)<br />Find and return the first occurrence of a regex in the input string | String |`regex`| String |
23
+
|[`capture`](#capture)<br />Find and return the first occurrence of a regex in the input string | String |`regex`| String |
24
24
|[`difference`](#difference)<br />Given two lists, keep only items that are in the 1st list but not in the 2nd. |[Objects]|`list`|[Objects]|
25
25
|[`every`](#every)<br />Checks whether all element in the list are `true`|[Bool]| - | Bool |
26
26
|[`filter`](#filter)<br />Reduce list of items into a list of same items that match the specified term |[String]<br />[Object]|`regex`, `term`, `list`, `attr`|[String]<br />[Object]|
@@ -31,34 +31,34 @@ The following functions are supported in addition to the built-in functions prov
31
31
|[`nope`](#nope)<br />Checks whether all element in the list are `false`|[Bool]| - | Bool |
32
32
|[`reject`](#reject)<br />Inverse of [`filter`](#filter), the result list contains non-matching items |[String]<br />[Object]|`regex`, `term`, `list`, `attr`|[String]<br />[Object]|
33
33
|[`some`](#some)<br />Checks whether at least one element in the list is `true`|[Bool]| - | Bool |
34
-
|[`readFile`](#readfile)<br />Reads the contents of a file from the current branch or "cm" folder | String |`path`| String |
|[`allDocs`](#alldocs)<br />Checks the list includes only documents |[`files`](./context-variables.md#files)| - | Bool |
45
-
|[`allImages`](#allimages)<br />Checks the list includes only images |[`files`](./context-variables.md#files)| - | Bool |
46
-
|[`allTests`](#alltests)<br />Checks the list includes only tests |[`files`](./context-variables.md#files)| - | Bool |
47
-
|[`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
48
-
|[`decode`](#decode)<br />Decode Base64 encoded string into an object | String (Base64 encoded) | - | Object |
49
-
|[`encode`](#encode)<br />Encode data into Base64 encoded string | Object | - | String (Base64 encoded) |
50
-
|[`estimatedReviewTime`](#estimatedreviewtime)<br />Estimated review time in minutes |[`branch`](./context-variables.md#branch)| - | Integer |
51
-
|[`extensions`](#extensions)<br />Lists all the unique file extensions |[String]| - |[String]|
52
-
|[`extractJitFindings`](#extractjitfindings) :fontawesome-brands-github: <br />Get an object with a summary of the findings found by the Jit scan |[`pr`](./context-variables.md#pr)| - | Object |
53
-
|[`extractSonarFindings`](#extractsonarfindings) :fontawesome-brands-github: <br />Get an object with a summary of the findings found by the SonarCloud scan |[`pr`](./context-variables.md#pr)| - | Object |
54
-
|[`explainRankByGitBlame`](#explainrankbygitblame)<br />Short markdown text explaining rankByGitBlame results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
55
-
|[`isFirstCommit`](#isfirstcommit)<br />Checks if its the author first commit in the repo |[`repo.contributors`](./context-variables.md#repo)| String | Bool |
56
-
|[`isFormattingChange`](#isformattingchange)<br />Checks that only formatting changed |[[`FileDiff`](./context-variables.md#filediff-structure)]| - | Bool |
57
-
|[`mapToEnum`](#maptoenum)<br />return the enum value matches to the input key | String | Enum object | Object |
58
-
|[`matchDiffLines`](#matchdifflines)<br />Match every line in diff |[[`FileDiff`](./context-variables.md#filediff-structure)]|`regex`, `ignoreWhiteSpaces`|[Bool]|
59
-
|[`rankByGitActivity`](#rankbygitactivity)<br />Get list of contributors based on `git-commit` activity |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
60
-
|[`rankByGitBlame`](#rankbygitblame)<br />Get list of contributors based on `git-blame` results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
|[`allDocs`](#alldocs)<br />Checks the list includes only documents |[`files`](./context-variables.md#files)| - | Bool |
45
+
|[`allImages`](#allimages)<br />Checks the list includes only images |[`files`](./context-variables.md#files)| - | Bool |
46
+
|[`allTests`](#alltests)<br />Checks the list includes only tests |[`files`](./context-variables.md#files)| - | Bool |
47
+
|[`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
48
+
|[`decode`](#decode)<br />Decode Base64 encoded string into an object | String (Base64 encoded) | - | Object |
49
+
|[`encode`](#encode)<br />Encode data into Base64 encoded string | Object | - | String (Base64 encoded) |
50
+
|[`estimatedReviewTime`](#estimatedreviewtime)<br />Estimated review time in minutes |[`branch`](./context-variables.md#branch)| - | Integer |
51
+
|[`extensions`](#extensions)<br />Lists all the unique file extensions |[String]| - |[String]|
52
+
|[`extractJitFindings`](#extractjitfindings) :fontawesome-brands-github: <br />Get an object with a summary of the findings found by the Jit scan |[`pr`](./context-variables.md#pr)| - | Object |
53
+
|[`extractSonarFindings`](#extractsonarfindings) :fontawesome-brands-github: <br />Get an object with a summary of the findings found by the SonarCloud scan |[`pr`](./context-variables.md#pr)| - | Object |
54
+
|[`explainRankByGitBlame`](#explainrankbygitblame)<br />Short markdown text explaining rankByGitBlame results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
55
+
|[`isFirstCommit`](#isfirstcommit)<br />Checks if its the author first commit in the repo |[`repo.contributors`](./context-variables.md#repo)| String | Bool |
56
+
|[`isFormattingChange`](#isformattingchange)<br />Checks that only formatting changed |[[`FileDiff`](./context-variables.md#filediff-structure)]| - | Bool |
57
+
|[`mapToEnum`](#maptoenum)<br />return the enum value matches to the input key | String | Enum object | Object |
58
+
|[`matchDiffLines`](#matchdifflines)<br />Match every line in diff |[[`FileDiff`](./context-variables.md#filediff-structure)]|`regex`, `ignoreWhiteSpaces`|[Bool]|
59
+
|[`rankByGitActivity`](#rankbygitactivity)<br />Get list of contributors based on `git-commit` activity |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
60
+
|[`rankByGitBlame`](#rankbygitblame)<br />Get list of contributors based on `git-blame` results |[`repo`](./context-variables.md#repo)|`gt`, `lt`|[String]|
61
+
|[`readFile`](#readfile)<br />Reads the contents of a file from the current branch or "cm" folder | String - The file path | String (optional) - the file type. `txt` or `json`| String |
62
62
</div>
63
63
64
64
### Named arguments
@@ -870,25 +870,6 @@ Check if the branch author is a rookie
Reads the contents of a file from the current branch or the "cm" folder and returns it as a string. This function only allows reading files from the "repo" and "cm" directories for security reasons.
| - | Input | String | The path to the file relative to the "repo" or "cm" directory |
882
-
| - | Output | String | The contents of the file as a string |
883
-
884
-
</div>
885
-
886
-
For example, to read a file named `config.yaml` from the "cm" directory:
887
-
888
-
```yaml+jinja
889
-
{{ "cm/config.yaml" | readFile }}
890
-
```
891
-
892
873
#### `rankByGitBlame`
893
874
894
875
Get list of contributors based on `git-blame` results
@@ -930,4 +911,23 @@ Check if the branch author is a rookie
930
911
931
912
```yaml+jinja
932
913
is_rookie: {{ repo | rankByGitBlame(lt=15) | match(term=branch.author) | some }}
933
-
```
914
+
```
915
+
916
+
#### `readFile`
917
+
918
+
Reads the contents of a file from the current branch or the "cm" folder and returns it as a string. This function only allows reading files from the "repo" and "cm" directories for security reasons.
0 commit comments