chore: Auto-commit extracted localization strings (#2089)
Removes `localize:extract` from pre-commit hook and commits changes from `localize:extract` in frontend PR build check.
This commit is contained in:
parent
612bbb6f42
commit
08aa2f86f3
@ -1,4 +1,4 @@
|
|||||||
name: Frontend Build Check
|
name: Frontend Prepare Build
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
@ -10,9 +10,17 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
setup-and-build:
|
setup-and-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
|
# added or changed files to the repository.
|
||||||
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# Setup:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
@ -31,29 +39,37 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
HUSKY: 0
|
HUSKY: 0
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
# Lint:
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
run: yarn lint:check
|
run: yarn lint:check
|
||||||
- name: Format
|
|
||||||
|
# Localize:
|
||||||
|
- name: Extract strings
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
# TODO Reenable when https://github.com/webrecorder/browsertrix-cloud/issues/1618 is addressed
|
run: yarn localize:extract
|
||||||
# run: yarn format:check
|
- name: Commit extracted strings
|
||||||
run: echo "yarn format:check disabled"
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
- name: Unit tests
|
with:
|
||||||
working-directory: frontend
|
commit_message: Apply `localize:extract` changes
|
||||||
run: yarn test
|
file_pattern: '**/*.xlf'
|
||||||
- name: Check extracted strings
|
skip_fetch: true
|
||||||
working-directory: frontend
|
skip_checkout: true
|
||||||
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: Check localization build
|
||||||
- name: Localization build
|
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
run: yarn localize:build
|
run: yarn localize:build
|
||||||
|
|
||||||
|
# Test:
|
||||||
|
- name: Unit tests
|
||||||
|
working-directory: frontend
|
||||||
|
run: yarn test
|
||||||
|
|
||||||
|
# Check build:
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
|
|
||||||
- name: Build Frontend
|
- name: Build Frontend
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -5,8 +5,6 @@
|
|||||||
if git diff --name-only --cached | grep --quiet 'frontend/src/';
|
if git diff --name-only --cached | grep --quiet 'frontend/src/';
|
||||||
then
|
then
|
||||||
cd frontend
|
cd frontend
|
||||||
yarn localize:extract
|
|
||||||
git add xliff
|
|
||||||
npx lint-staged
|
npx lint-staged
|
||||||
else
|
else
|
||||||
echo "(no frontend/src changes - skipping pre-commit hook)"
|
echo "(no frontend/src changes - skipping pre-commit hook)"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user