Ensure that CI fails if extracted strings don't match (#2078)
- Ensures extracted strings get formatted before checking against index - Fixes index check by switching from `git diff-index` to `git diff`, and ensures the proper `--exit-code` flag is present (implicitly turned on by `--quiet`) - Adds actionable error message when the check fails - Updates Github's actions versions from v3 to v4 (major version bump is primarily just for default node version updates, but this way we'll get future updates) - Adds formatting step to npm script for extracting messages - Runs a string extraction & format against current main
This commit is contained in:
parent
123705c53f
commit
9a799cc8ab
8
.github/workflows/frontend-build-check.yaml
vendored
8
.github/workflows/frontend-build-check.yaml
vendored
@ -12,15 +12,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: frontend/yarn.lock
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: frontend/dist
|
||||
key: ${{ runner.os }}-btrix-frontend-build-${{ hashFiles('frontend/dist') }}
|
||||
@ -44,7 +44,7 @@ jobs:
|
||||
run: yarn test
|
||||
- name: Check extracted strings
|
||||
working-directory: frontend
|
||||
run: yarn localize:extract && git diff-index HEAD --
|
||||
run: yarn localize:extract && if ! git diff --quiet -- ; then echo "Error extracting strings, please run \`yarn localize:extract\` from the \`frontend\` directory and commit the results."; false; fi
|
||||
- name: Localization build
|
||||
working-directory: frontend
|
||||
run: yarn localize:build
|
||||
|
@ -96,7 +96,7 @@
|
||||
"lint:lit-analyzer": "lit-analyzer",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"localize:extract": "lit-localize extract",
|
||||
"localize:extract": "lit-localize extract && prettier --write xliff/*.xlf",
|
||||
"localize:build": "lit-localize build"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -123,7 +123,7 @@
|
||||
"chromium": "^3.0.3"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,js,html,css,json,webmanifest,xlf}": "prettier --write"
|
||||
"*.{ts,js,html,css,json,webmanifest}": "prettier --write"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user