Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Auto-commit extracted localization strings #2089

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Frontend Build Check
name: Frontend Prepare Build
on:
pull_request:
paths:
Expand All @@ -10,9 +10,17 @@ on:
jobs:
setup-and-build:
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:
# Setup:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
Expand All @@ -31,29 +39,37 @@ jobs:
env:
HUSKY: 0
run: yarn install --frozen-lockfile

# Lint:
- name: Lint
working-directory: frontend
run: yarn lint:check
- name: Format

# Localize:
- name: Extract strings
working-directory: frontend
# TODO Reenable when https://github.com/webrecorder/browsertrix-cloud/issues/1618 is addressed
# run: yarn format:check
run: echo "yarn format:check disabled"
run: yarn localize:extract
- name: Commit extracted strings
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply `localize:extract` changes
file_pattern: '**/*.xlf'
skip_fetch: true
skip_checkout: true
- name: Check localization build
working-directory: frontend
run: yarn localize:build

# Test:
- name: Unit tests
working-directory: frontend
run: yarn test
- name: Check extracted strings
working-directory: frontend
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

# Check build:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host

- name: Build Frontend
uses: docker/build-push-action@v3
with:
Expand Down
2 changes: 0 additions & 2 deletions frontend/.husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
if git diff --name-only --cached | grep --quiet 'frontend/src/';
then
cd frontend
yarn localize:extract
git add xliff
npx lint-staged
else
echo "(no frontend/src changes - skipping pre-commit hook)"
Expand Down
Loading