@@ -14,14 +14,32 @@ jobs:
1414 - name : Checkout
1515 uses : actions/checkout@v4
1616
17- - name : Bump cacheBust in README
17+ - name : Bump cacheBust in all README files
1818 run : |
1919 set -euo pipefail
20- TS=$(date +%s)
21- if grep -q 'cacheBust=' README.md; then
22- sed -i "s/cacheBust=[0-9]\+/cacheBust=${TS}/g" README.md
23- else
24- echo "cacheBust parameter not found in README.md" >&2
20+ TS="$(date +%s)"
21+ # Target only the root README.md and localized READMEs under locales/*/README.md
22+ mapfile -t FILES < <(git ls-files README.md 'locales/*/README.md' || true)
23+
24+ if [ "${#FILES[@]}" -eq 0 ]; then
25+ echo "No target README files found." >&2
26+ exit 1
27+ fi
28+
29+ UPDATED=0
30+ for f in "${FILES[@]}"; do
31+ if grep -q 'cacheBust=' "$f"; then
32+ # Use portable sed in GNU environment of ubuntu-latest
33+ sed -i -E "s/cacheBust=[0-9]+/cacheBust=${TS}/g" "$f"
34+ echo "Updated cacheBust in $f"
35+ UPDATED=1
36+ else
37+ echo "Warning: cacheBust parameter not found in $f" >&2
38+ fi
39+ done
40+
41+ if [ "$UPDATED" -eq 0 ]; then
42+ echo "No files were updated. Ensure READMEs embed contrib.rocks with cacheBust param." >&2
2543 exit 1
2644 fi
2745
@@ -39,11 +57,11 @@ jobs:
3957 uses : peter-evans/create-pull-request@v7
4058 with :
4159 token : ${{ secrets.GITHUB_TOKEN }}
42- commit-message : " chore: refresh contrib.rocks image cache [skip ci]"
60+ commit-message : " chore: refresh contrib.rocks image cache across all READMEs [skip ci]"
4361 committer : " github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
4462 branch : refresh-contrib-cache
4563 delete-branch : true
46- title : " Refresh contrib.rocks image cache"
64+ title : " Refresh contrib.rocks image cache (all READMEs) "
4765 body : |
48- Automated refresh of the contrib.rocks image cache by bumping the cacheBust parameter in README.md.
66+ Automated refresh of the contrib.rocks image cache by bumping the cacheBust parameter in README.md and locales/*/README.md .
4967 base : main
0 commit comments