Make WordPress Core

Changeset 56792


Ignore:
Timestamp:
10/06/2023 12:45:43 PM (8 months ago)
Author:
desrosj
Message:

Build/Test Tools: Check for zero-byte files in themes.

Because the contents of binary files are not included in patches by default, occasionally empty versions of these files are committed on accident. This is the most commonly happens within default themes because they usually contain image and font files.

This adds a job to the theme related GitHub Action workflow that checks for the presence of zero-byte files so that these instances are caught more easily.

Props costdev, hellofromTonya, luminuu, onemaggie.
Fixes #59527.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/test-and-zip-default-themes.yml

    r56770 r56792  
    5050
    5151jobs:
     52  # Checks for zero-byte files.
     53  #
     54  # Occasionally, binary files such as images and fonts are added to themes incorrectly.
     55  # This checks that all files contain contents.
     56  #
     57  # Performs the following steps:
     58  # - Checks out the repository.
     59  # - Checks for zero-byte (empty) files.
     60  check-for-empty-files:
     61    name: ${{ matrix.theme }} empty file check
     62    runs-on: ubuntu-latest
     63    permissions:
     64      contents: read
     65    timeout-minutes: 10
     66    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     67    strategy:
     68      fail-fast: false
     69      matrix:
     70        theme: [
     71          'twentytwentyfour',
     72          'twentytwentythree',
     73          'twentytwentytwo',
     74          'twentytwentyone',
     75          'twentytwenty',
     76          'twentynineteen',
     77          'twentyseventeen',
     78          'twentysixteen',
     79          'twentyfifteen',
     80          'twentyfourteen',
     81          'twentythirteen',
     82          'twentytwelve',
     83          'twentyeleven',
     84          'twentyten'
     85        ]
     86
     87    steps:
     88      - name: Checkout repository
     89        uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
     90        with:
     91          ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
     92          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
     93
     94      - name: Check for zero-byte (empty) files
     95        run: |
     96          [[ ! $(find src/wp-content/themes/${{ matrix.theme }} -empty) ]]
     97
    5298  # Tests the build script for themes that have one.
    5399  #
     
    111157    permissions:
    112158      contents: read
    113     needs: [ test-build-scripts ]
     159    needs: [ check-for-empty-files, test-build-scripts ]
    114160    timeout-minutes: 10
    115161    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     
    154200      actions: read
    155201      contents: read
    156     needs: [ bundle-theme, test-build-scripts ]
     202    needs: [ check-for-empty-files, bundle-theme, test-build-scripts ]
    157203    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    158204    with:
Note: See TracChangeset for help on using the changeset viewer.