Skip to content

Commit d656311

Browse files
authored
Merge pull request #658 from linear-b/add-code-comment-action
Code coment action
2 parents 5f64d20 + 76b988d commit d656311

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/automation-actions.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Actions are the end results of the automation described in your `.cm` file.
2020
[`send-http-request`](#send-http-request) is executed immediately after the evaluation of the condition.
2121
For all other actions, gitStream executes the actions in the order they are listed per automation. If an action result fails, the following actions will not be executed.
2222

23+
- [`add-code-comment`](#add-code-comment) :fontawesome-brands-github: :fontawesome-brands-gitlab:
2324
- [`add-comment`](#add-comment) :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
2425
- [`add-github-check`](#add-github-check) :fontawesome-brands-github:
2526
- [`add-label`](#add-label) :fontawesome-brands-github: :fontawesome-brands-gitlab:
@@ -61,6 +62,39 @@ automations:
6162

6263
## Reference
6364

65+
#### `add-code-comment` :fontawesome-brands-github: :fontawesome-brands-gitlab:
66+
67+
This action, once triggered, adds a single code comment to the PR.
68+
69+
This is a managed action, when PR updates, the existing comments added by gitStream are re-evaluated, and those that are not applicable are removed.
70+
71+
<div class="filter-details" markdown=1>
72+
73+
| Args | Usage | Type | Description |
74+
| -----------|------|-----|------------------------------------------------ |
75+
| `comment` | Required | String | Sets the comment, markdown is supported, including suggestion syntax (```suggestion … ```) |
76+
| `file_path` | Required | String | The relative path to the file that necessitates the comment |
77+
| `start_line` | Optional | Integer | The line (or the first line in multi-line comment)of the blob in the pull request diff that the comment applies to
78+
If start_line is empty, the code comment should be on the file provided |
79+
| `end_line` | Optional | Integer | For a multi-line comment, the last line of the range that your comment applies to.
80+
Must be equal to or larger than start_line |
81+
82+
</div>
83+
84+
```yaml+jinja title="example"
85+
automations:
86+
senior_review:
87+
if:
88+
- true
89+
run:
90+
- action: add-code-comment@v1
91+
args:
92+
file_path: <FILE>
93+
start_line: 20
94+
comment: |
95+
Magic! Move it to a constant variable.
96+
```
97+
6498
#### `add-comment` :fontawesome-brands-github: :fontawesome-brands-gitlab: :fontawesome-brands-bitbucket:
6599

66100
This action, once triggered, adds a comment to the PR.

0 commit comments

Comments
 (0)