✨ Add new custom-cache-suffix option#239
Conversation
| # via the first workflow which is run every Monday. | ||
| - uses: "ramsey/composer-install@v2" | ||
| with: | ||
| custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") |
|
Something about the cache_key_08.exp test is causing a failure, but I can't tell what it is yet. |
As discussed in 234. Includes tests. Fixes 234
d2954eb to
6f57711
Compare
Windows and file permissions. Should be fixed now. |
|
Hmm.. Composer v1 still giving trouble... |
|
(which is weird as I had a passing build before I tidied up and rebased) |
|
@ramsey As by now it's not the new test which is failing, could you restart the build just to check it wasn't some Composer hick-up ? |
|
Re-running |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v2 #239 +/- ##
==========================================
+ Coverage 97.45% 97.47% +0.02%
==========================================
Files 5 5
Lines 118 119 +1
==========================================
+ Hits 115 116 +1
Misses 3 3
|
|
Right first round done: applied this in some 40 repos ;-) For anyone looking for some more date-based example code: - name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Bust the cache at least once every three months - output format: YYYYqQ, example: 2022q4.
custom-cache-suffix: $(/bin/date +%Y)q$(( ($(/bin/date +%-m)-1)/3+1 ))
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Bust the cache at least once a week - output format: YYYY-MM-DD.
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") |
|
Simplified version of the "once a month" code sample: - name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m") |
Description
As discussed in #234.
This adds a new
custom-cache-suffixoption to the action which allows for adding a custom addition to the cache key, which can be helpful to break out of outdated caches, especially when a project does not have a committedcomposer.lockfile.Fixes #234
Motivation and context
See #234
How has this been tested?
Both unit tests as well as integration tests are included with the PR.
Types of changes
PR checklist