name: Compressed Size

on: [pull_request_target]

permissions:
  contents: read

jobs:
  build:

    permissions:
      checks: write  # for preactjs/compressed-size-action to create and update the checks
      contents: read  # for actions/checkout to fetch code
      issues: write  # for preactjs/compressed-size-action to create comments
      pull-requests: write  # for preactjs/compressed-size-action to write a PR review
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - uses: pnpm/action-setup@v2.2.2
    - uses: preactjs/compressed-size-action@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

  size-limit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: pnpm/action-setup@v2.2.2
    - uses: andresz1/size-limit-action@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
