Skip to content

Commit 1eed6ad

Browse files
committed
Build/Test Tools: Configure Composer caching with input where possible.
This removes an unnecessary step and output/input when the date used for cache keys is only used in one place by passing the command directly through the `custom-cache-key` input. See #64893. git-svn-id: https://develop.svn.wordpress.org/trunk@62443 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 75d6e2f commit 1eed6ad

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

.github/workflows/reusable-check-built-files.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
# Performs the following steps:
1818
# - Checks out the repository.
1919
# - Sets up Node.js.
20-
# - Configures caching for Composer.
2120
# - Installs Composer dependencies.
2221
# - Logs general debug information about the runner.
2322
# - Installs npm dependencies.
@@ -48,18 +47,12 @@ jobs:
4847
node-version-file: '.nvmrc'
4948
cache: npm
5049

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-
5750
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
5851
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
5952
- name: Install Composer dependencies
6053
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
6154
with:
62-
custom-cache-suffix: ${{ steps.get-date.outputs.date }}
55+
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
6356

6457
- name: Log debug information
6558
run: |

.github/workflows/reusable-phpstan-static-analysis-v1.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
# Performs the following steps:
2525
# - Checks out the repository.
2626
# - Sets up PHP.
27-
# - Logs debug information.
2827
# - Installs Composer dependencies.
28+
# - Logs debug information.
2929
# - Configures caching for PHP static analysis scans.
3030
# - Make Composer packages available globally.
3131
# - Runs PHPStan static analysis (with Pull Request annotations).
@@ -58,12 +58,6 @@ jobs:
5858
coverage: none
5959
tools: cs2pr
6060

61-
# This date is used to ensure that the Composer cache is cleared at least once every week.
62-
# http://man7.org/linux/man-pages/man1/date.1.html
63-
- name: "Get last Monday's date"
64-
id: get-date
65-
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT"
66-
6761
- name: General debug information
6862
run: |
6963
npm --version
@@ -75,7 +69,7 @@ jobs:
7569
- name: Install Composer dependencies
7670
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
7771
with:
78-
custom-cache-suffix: ${{ steps.get-date.outputs.date }}
72+
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
7973

8074
- name: Make Composer packages available globally
8175
run: echo "${PWD}/vendor/bin" >> "$GITHUB_PATH"

0 commit comments

Comments
 (0)