Skip to content

Commit 79a6bd6

Browse files
committed
Configure Composer caching.
1 parent 1c84433 commit 79a6bd6

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/compare-build-script-results.yml renamed to .github/workflows/compare-built-files.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Compares Built Files
22

33
on:
4-
# JSHint was introduced in WordPress 3.8.
5-
# PHPCS checking was introduced in WordPress 5.1.
64
push:
75
branches:
86
- trunk
@@ -42,8 +40,8 @@ permissions: {}
4240
jobs:
4341
# Compares the results of the build script with WordPress/WordPress.
4442
compare-build-script-results:
45-
name: Compare built PR to WordPress/WordPress
46-
uses: ./.github/workflows/reusable-compare-build-script-results-v1.yml
43+
name: Compare PR's built files to WordPress/WordPress
44+
uses: reusable-compare-built-files-v1.yml
4745
permissions:
4846
contents: read
4947
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}

.github/workflows/reusable-compare-build-script-results-v1.yml renamed to .github/workflows/reusable-compare-built-files-v1.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
# A reusable workflow that compares the results of the build script with the most recent build server commit.
33
##
4-
name: Reusable Compare Build Script Results
4+
name: Reusable Compare Built Files
55

66
on:
77
workflow_call:
@@ -48,6 +48,19 @@ jobs:
4848
node-version-file: '.nvmrc'
4949
cache: npm
5050

51+
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
52+
# http://man7.org/linux/man-pages/man1/date.1.html
53+
- name: "Get last Monday's date"
54+
id: get-date
55+
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT"
56+
57+
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
58+
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
59+
- name: Install Composer dependencies
60+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
61+
with:
62+
custom-cache-suffix: ${{ steps.get-date.outputs.date }}
63+
5164
- name: Log debug information
5265
run: |
5366
npm --version

0 commit comments

Comments
 (0)