# =============================================================================
# PR: Compressed Size — 构建产物体积监控
#
# 触发时机: PR 打开 / 有新推送时自动运行
# 功能: 对比 dist/**/*.{js,css,d.ts} 的压缩体积变化,在 PR 中显示 diff
# =============================================================================

name: 'PR: Compressed Size'

on:
  pull_request:
    types: [opened, synchronize]

permissions:
  contents: read
  pull-requests: write

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 20

    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version-file: .node-version
          cache: 'yarn'
      - uses: preactjs/compressed-size-action@v2
        with:
          pattern: './packages/cherry-markdown/dist/**/*.{js,css,d.ts}'
          install-script: 'yarn --frozen-lockfile --ignore-engines'