Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Give clearer feedback for how to fix outdated POT file in CI (#1065)

sarayourfriend701aafc30a84
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7478c8bcb..d60da6ae8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -47,9 +47,7 @@ jobs:
- name: Check POT files are updated
shell: bash
- run: |
- pnpm i18n:generate-pot
- exit $(git status -s -uno | wc -l)
+ run: pnpm i18n:generate-pot
unit:
name: Unit tests
diff --git a/src/locales/scripts/json-to-pot.js b/src/locales/scripts/json-to-pot.js
index 58522cfbc..098c2131e 100644
--- a/src/locales/scripts/json-to-pot.js
+++ b/src/locales/scripts/json-to-pot.js
@@ -20,6 +20,12 @@ try {
}
fs.writeFileSync(fileName, createPotFile(json))
+ if (process.env.CI) {
+ console.error(
+ 'Detected uncommitted POT file changes. Please run `pnpm i18n:generate-pot` and commit the updated POT file.'
+ )
+ process.exit(1)
+ }
console.log(`Successfully wrote pot file to ${fileName}`)
} catch (err) {
console.error(err)