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
Instead of posting a separate comment, the action can inject the report into a section of the **pull request description**, handy when you use a PR template and want coverage to live in a specific place. Add a start/end marker pair to your PR template, and the action will replace everything between them on every run, leaving the rest of the description untouched:
146
+
147
+
```md
148
+
## Coverage
149
+
150
+
<!-- vitest-coverage-report-marker-start-root -->
151
+
<!-- vitest-coverage-report-marker-end-root -->
152
+
```
153
+
154
+
The `root` suffix is the same postfix used for the comment marker: it defaults to `root`, but becomes the [`name`](#name) if you set one (or the `working-directory` otherwise). So a step with `name: 'Frontend'` looks for `...-marker-start-Frontend`/`...-marker-end-Frontend`, which lets you inject several reports into one description:
- Rewriting the description needs the same [`pull-requests: write`](#required-permissions) permission as commenting, so there's nothing extra to grant, but a read-only token can't update it and the run will fail.
167
+
- When the markers are present, the report goes into the description **only**, no comment is posted. If you previously ran in comment mode, delete the old comment once by hand.
168
+
- Only one marker of a pair (or an end before its start) is treated as a mistake: the action logs a warning and falls back to posting a comment.
169
+
- Because every run rewrites the same description, parallel jobs writing **different** markers into it can clobber each other (last write wins). If you inject multiple reports into one description, run them in a single job or guard them with a [`concurrency`](https://docs.github.com/en/actions/using-jobs/using-concurrency) group.
170
+
143
171
#### Threshold Icons
144
172
145
173
If you haven't established strict coverage thresholds in your `vitest.config` (which would fail the test run), you can still use the `threshold-icons` option to control the status icons displayed in the PR comment based on coverage percentage.
`Found incomplete coverage markers in the pull request body. Expected both "${start}" and "${end}" with the start before the end. Falling back to a comment.`,
101
+
);
102
+
returnfalse;
103
+
}
104
+
105
+
constbefore=body.slice(0,startIdx+start.length);
106
+
constafter=body.slice(endIdx);
107
+
conststub=oversizeStub();
108
+
109
+
// Reserve one stub's worth of room per other marker region so sibling runs
110
+
// can still write their own region into the shared body. Empty regions are
111
+
// the ones that still need to grow. The +2 accounts for the newlines that
0 commit comments