Skip to content

Commit 5fa2be4

Browse files
authored
Merge pull request #572 from linear-b/decode-and-encode
Decode and encode
2 parents 2201cf3 + 6f08e42 commit 5fa2be4

File tree

1 file changed

+51
-17
lines changed

1 file changed

+51
-17
lines changed

docs/filter-functions.md

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,25 @@ The following functions are supported in addition to the built-in functions prov
3838

3939
<div class="big-summary" markdown=1>
4040

41-
| Function | Input | Args | Output |
42-
| --------------- | ------- | ---- | ---- |
43-
| [`allDocs`](#alldocs)<br />Checks the list includes only documents | [`files`](./context-variables.md#files) | - | Bool |
44-
| [`allImages`](#allimages)<br />Checks the list includes only images | [`files`](./context-variables.md#files) | - | Bool |
45-
| [`allTests`](#alltests)<br />Checks the list includes only tests | [`files`](./context-variables.md#files) | - | Bool |
46-
| [`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results| [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
47-
| [`estimatedReviewTime`](#estimatedreviewtime)<br />Estimated review time in minutes | [`branch`](./context-variables.md#branch)| - | Integer |
48-
| [`extensions`](#extensions)<br />Lists all the unique file extensions | [String] | - | [String] |
49-
| [`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 |
50-
| [`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 |
51-
| [`explainRankByGitBlame`](#explainrankbygitblame)<br />Short markdown text explaining rankByGitBlame results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
52-
| [`isFirstCommit`](#isfirstcommit)<br />Checks if its the author first commit in the repo | [`repo.contributors`](./context-variables.md#repo) | String | Bool |
53-
| [`isFormattingChange`](#isformattingchange)<br />Checks that only formatting changed | [[`FileDiff` ](./context-variables.md#filediff-structure)] | - | Bool |
54-
| [`mapToEnum`](#maptoenum)<br />return the enum value matches to the input key | String | Enum object | Object |
55-
| [`matchDiffLines`](#matchdifflines)<br />Match every line in diff | [[`FileDiff` ](./context-variables.md#filediff-structure)] | `regex`, `ignoreWhiteSpaces` | [Bool] |
56-
| [`rankByGitActivity`](#rankbygitactivity)<br />Get list of contributors based on `git-commit` activity | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
57-
| [`rankByGitBlame`](#rankbygitblame)<br />Get list of contributors based on `git-blame` results| [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
41+
| Function | Input | Args | Output |
42+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------- | ----------------------- |
43+
| [`allDocs`](#alldocs)<br />Checks the list includes only documents | [`files`](./context-variables.md#files) | - | Bool |
44+
| [`allImages`](#allimages)<br />Checks the list includes only images | [`files`](./context-variables.md#files) | - | Bool |
45+
| [`allTests`](#alltests)<br />Checks the list includes only tests | [`files`](./context-variables.md#files) | - | Bool |
46+
| [`codeExperts`](#codeexperts)<br />Get list of contributors based on expert reviewer model results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
47+
| [`decode`](#decode)<br />Decode Base64 encoded string into an object | String (Base64 encoded) | - | Object |
48+
| [`encode`](#encode)<br />Encode data into Base64 encoded string | Object | - | String (Base64 encoded) |
49+
| [`estimatedReviewTime`](#estimatedreviewtime)<br />Estimated review time in minutes | [`branch`](./context-variables.md#branch) | - | Integer |
50+
| [`extensions`](#extensions)<br />Lists all the unique file extensions | [String] | - | [String] |
51+
| [`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 |
52+
| [`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 |
53+
| [`explainRankByGitBlame`](#explainrankbygitblame)<br />Short markdown text explaining rankByGitBlame results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
54+
| [`isFirstCommit`](#isfirstcommit)<br />Checks if its the author first commit in the repo | [`repo.contributors`](./context-variables.md#repo) | String | Bool |
55+
| [`isFormattingChange`](#isformattingchange)<br />Checks that only formatting changed | [[`FileDiff` ](./context-variables.md#filediff-structure)] | - | Bool |
56+
| [`mapToEnum`](#maptoenum)<br />return the enum value matches to the input key | String | Enum object | Object |
57+
| [`matchDiffLines`](#matchdifflines)<br />Match every line in diff | [[`FileDiff` ](./context-variables.md#filediff-structure)] | `regex`, `ignoreWhiteSpaces` | [Bool] |
58+
| [`rankByGitActivity`](#rankbygitactivity)<br />Get list of contributors based on `git-commit` activity | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
59+
| [`rankByGitBlame`](#rankbygitblame)<br />Get list of contributors based on `git-blame` results | [`repo`](./context-variables.md#repo) | `gt`, `lt` | [String] |
5860

5961
</div>
6062

@@ -406,6 +408,38 @@ automations:
406408
reviewers: {{ repo | codeExperts(gt=10) }}
407409
```
408410

411+
#### `decode`
412+
413+
Decode Base64 encoded string into an object. Encoded strings are formatted: `"base64: <encoded_string>"`
414+
<div class="filter-details" markdown=1>
415+
416+
| Argument | Usage | Type | Description |
417+
| -------- | ------ | ------ | ------------------------------------------- |
418+
| - | Input | String | Base64 encoded string prefixed `"Base64: "` |
419+
| - | Output | Object | Decoded objet |
420+
421+
</div>
422+
423+
```yaml+jinja
424+
{{ "base64: SGVsbG8gV29ybGQ=" | decode }} # Output: "Hello World"
425+
```
426+
427+
#### `encode`
428+
429+
Encode data into Base64 encoded string. When an encoded string is passed as input for [`add-comment`](./automation-actions.md#add-comment), the action automatically detects and decodes it.
430+
<div class="filter-details" markdown=1>
431+
432+
| Argument | Usage | Type | Description |
433+
| -------- | ------ | ------------ | ----------------------------------- |
434+
| - | Input | Object | The input object to encode |
435+
| - | Output | String (Base64) | Base64 encoding of the object |
436+
437+
</div>
438+
439+
```yaml+jinja
440+
{{ "Hello World" | encode }} # Output: "base64: SGVsbG8gV29ybGQ="
441+
```
442+
409443
#### `estimatedReviewTime`
410444

411445
Returns the estimated review time in minutes based on statistical model.

0 commit comments

Comments
 (0)