Skip to content

Border: Add a PHP helper for block support classes and styles #140400

Border: Add a PHP helper for block support classes and styles

Border: Add a PHP helper for block support classes and styles #140400

Workflow file for this run

name: Compressed Size
on:
pull_request:
paths:
# Any change to a CSS, Sass, or JavaScript/TypeScript file should run checks.
- '**.js'
- '**.ts'
- '**.tsx'
- '**.mts'
- '**.cts'
- '**.cjs'
- '**.mjs'
- '**.css'
- '**.scss'
# Changes to any NPM related files could affect the outcome.
- '**package*.json'
# These files configures ESLint. Changes could affect the outcome.
- '**.eslint*'
# These files configures JSHint. Changes could affect the outcome.
- '**.jshint*'
# These files configures Prettier. Changes could affect the outcome.
- '**.prettier*'
# These files configures stylelint. Changes could affect the outcome.
- '**.stylelint*'
# These files configures TypeScript. Changes could affect the outcome.
- '**.tsconfig*'
# This file configures Webpack. Changes could affect the outcome.
- 'webpack.config.js'
# Changes to this workflow file should always verify the changes are successful.
- '.github/workflows/bundle-size.yml'
- tools/build-scripts/packages
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
build:
name: Check
runs-on: 'ubuntu-24.04'
permissions:
contents: read
# Only used on a fork, where the action falls back to commenting and
# its own failure handling takes over. See `use-check` below.
pull-requests: write
checks: write
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Use desired version of Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
check-latest: true
package-manager-cache: false
- name: Set up npm
uses: ./.github/setup-npm
- uses: preactjs/compressed-size-action@f322c295dde06a1cb7ccaef105732dd8a726d1d9 # v2.10.0
id: size
with:
omit-unchanged: true
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pattern: '{build/scripts/**/*.min.js,build/styles/**/*.css,build/modules/**/*.min.js}'
clean-script: 'distclean'
build-script: 'build'
# Report a check rather than a comment, leaving the size report
# to the unified comment. Not on a fork: its token cannot create
# a check, and the check path, unlike the comment path, does not
# catch that failure.
use-check: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
- name: Save the size report
if: ${{ !cancelled() && steps.size.outputs.comment-body }}
env:
# Through the environment, never interpolated into the script.
BODY: ${{ steps.size.outputs.comment-body }}
run: |
mkdir -p "${RUNNER_TEMP}/pr-meta"
# Drop the action's own footer, which the unified comment replaces.
printf '%s' "$BODY" | sed '/compressed-size-action<\/sub>/d' > "${RUNNER_TEMP}/pr-meta/body.md"
- name: Upload the size report
if: ${{ !cancelled() && steps.size.outputs.comment-body }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pr-meta--bundle-size
path: ${{ runner.temp }}/pr-meta
if-no-files-found: ignore
pr-meta:
name: Update PR meta comment
needs: build
# Runs even when the build failed, so a stale size report is cleared.
# Skipped on a fork, whose token cannot write a comment.
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: 'ubuntu-slim'
permissions:
contents: read
pull-requests: write
timeout-minutes: 5
# Every writer of this comment shares one lock, across workflows. The
# default `queue: single` would cancel a pending writer once a third
# arrived, silently dropping its section.
concurrency:
group: pr-meta-${{ github.event.number }}
cancel-in-progress: false
queue: max
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: tools/pr-meta
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
continue-on-error: true
with:
name: pr-meta--bundle-size
path: pr-meta
- uses: ./tools/pr-meta
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
section: bundle-size
body-path: pr-meta/body.md
commit-sha: ${{ github.event.pull_request.head.sha }}
run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}