Skip to content

Commit

Permalink
Add docs to readme for the comment-key option
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Sep 27, 2024
1 parent 4f889fa commit 2fc32c1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,32 @@ By default, files are compared after gzip compression, but it's possible to use
```yaml
compression: "none"
```

### Checking multiple bundles

The action reuses the same comment each time it runs on a PR. In order to run the action multiple times against separate bundles for a single PR, you must provide a `comment-key` option, which the action will use to determine which comment to add or update for the run. The example below demonstrates this for separate "modern" and "legacy" bundles:

```yaml
name: Compressed Size
on: [pull_request]
jobs:
modern-bundle-size-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v2
with:
build-script: "build:modern"
comment-key: modern
legacy-bundle-size-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v2
with:
build-script: "build:legacy"
comment-key: legacy
```

If you do not provide this key, the action will attempt to use (and therefore replace) the same comment for both bundles, hiding the output for whichever run finished last.

0 comments on commit 2fc32c1

Please sign in to comment.