From 3f8c0905778ae4ef514c3d47b13b10cd1ea34066 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 19 Nov 2025 15:16:15 +0200 Subject: [PATCH] cache just the `.js` files, to avoid stale translations --- .github/actions/build-translations/action.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-translations/action.yml b/.github/actions/build-translations/action.yml index 4515346dcf..ea565f9194 100644 --- a/.github/actions/build-translations/action.yml +++ b/.github/actions/build-translations/action.yml @@ -8,17 +8,19 @@ inputs: runs: using: 'composite' steps: - - name: 📝 Extract English source strings + - name: 📝 Extract all translation strings shell: bash - run: yarn intl:extract + run: yarn intl:extract:all - name: 🔑 Generate cache key id: cache-key shell: bash run: | - EN_HASH=$(cat src/locale/locales/en/messages.po | shasum -a 256 | cut -d' ' -f1) - YARN_HASH=$(cat yarn.lock | shasum -a 256 | cut -d' ' -f1) - CACHE_KEY="translations-${EN_HASH}-${YARN_HASH}" + # Hash all .po files to detect any translation changes + PO_HASH=$(find src/locale/locales -name "messages.po" -type f -exec cat {} \; | shasum -a 256 | cut -d' ' -f1) + # Get @lingui/cli version to bust cache on compiler upgrades + LINGUI_VERSION=$(grep '"version"' node_modules/@lingui/cli/package.json | head -1 | sed 's/.*"version": "\(.*\)".*/\1/') + CACHE_KEY="translations-${PO_HASH}-lingui-${LINGUI_VERSION}" echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT echo "Cache key: ${CACHE_KEY}" @@ -26,9 +28,7 @@ runs: id: cache-translations uses: actions/cache@v4 with: - path: | - src/locale/locales/*/messages.po - src/locale/locales/*/messages.js + path: src/locale/locales/*/messages.js key: ${{ steps.cache-key.outputs.key }} - name: 🔤 Compile translations