From 640d23cd66eee69d01a70927caf2957d02591916 Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Fri, 21 Feb 2025 13:29:40 -0800 Subject: [PATCH] Test auto-update of strings file --- .github/workflows/build-client.yml | 26 ++++++++++++++++++++++++++ client/src/data/copy/common.tsx | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index fc56894b..e6dcd190 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -106,6 +106,8 @@ jobs: defaults: run: working-directory: client + permissions: + contents: write steps: - uses: actions/checkout@v4 @@ -117,6 +119,30 @@ jobs: - name: Install run: npm ci + - name: Extract English from source code + id: extract + if: github.event_name == 'pull_request' + run: | + ENGLISH_FILE='src/intl/en.json' + npm run intl:extract + if (git diff --exit-code "${ENGLISH_FILE}" > /dev/null); then + echo 'english-changed=' >> "${GITHUB_OUTPUT}" + else + echo 'english-changed=true' >> "${GITHUB_OUTPUT}" + git add "${ENGLISH_FILE}" + git commit -m 'Auto-update en.json from component source code' + git push + fi + + - if: github.event_name == 'pull_request' && steps.extract.outputs.english-changed == 'true' + uses: thollander/actions-comment-pull-request@v3 + with: + message: | + :wave: FYI, your PR has been automatically updated with changes to + `client/src/intl/en.json`, which contains all the translatable text + from the application (probably because you made changes to + the text of a component without updating this file). + - name: Check Spanish translations # TODO: Make this error fatal when we have a strategy for translations! # diff --git a/client/src/data/copy/common.tsx b/client/src/data/copy/common.tsx index 5633b92a..a139d181 100644 --- a/client/src/data/copy/common.tsx +++ b/client/src/data/copy/common.tsx @@ -56,7 +56,7 @@ export const UPDATE_BANNER_CONTENT_LARGE = This is an unofficial copy of the CEJST Tool. We are working on an overhaul, but in the meantime some links and text may incorrectly suggest that this site is affiliated with the US Government.`} + defaultMessage={`This is an unofficial copy of the CEJST Tool!!!! We are working on an overhaul, but in the meantime some links and text may incorrectly suggest that this site is affiliated with the US Government.`} description={`Alert body that appears at the top of pages.`} values={{ bold: boldFn,