Skip to content

Commit 344e7fa

Browse files
authored
docs: update README to include comment-body output (#150)
1 parent 55bc264 commit 344e7fa

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ jobs:
3131
3232
> **Note:** Due to GitHub's permission model, this action cannot safely create comments when it is triggered by a PR from a fork. It will, however, still generate the size comparison and print the comment it would've posted to the stdout of the action, allowing manual checking and you can copy/paste it into a comment if you wish.
3333
34+
The markdown comment that `compressed-size-action` posts to pull requests is also exposed as the `comment-body` output. This can be used by later workflow steps to archive the report, pass it to another job, or post the comment from a separate workflow with the permissions you need:
35+
36+
```yaml
37+
- id: compressed-size
38+
uses: preactjs/compressed-size-action@v2
39+
40+
- name: Save compressed size comment
41+
env:
42+
COMMENT_BODY: ${{ steps.compressed-size.outputs.comment-body }}
43+
run: printf '%s\n' "$COMMENT_BODY" > compressed-size-comment.md
44+
```
45+
3446
### Customizing the Installation
3547

3648
By default, `compressed-size-action` will install dependencies according to which lockfiles are present, if any. However, if you need to run a different installation command, you can pass a custom script to do so. For example, to use `npm ci` with the `--workspace` option:

0 commit comments

Comments
 (0)