Skip to content

Extract translation strings #4649

Extract translation strings

Extract translation strings #4649

name: Check formatting
on:
push:
branches: "*"
pull_request:
branches: "*"
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Prettier version
id: prettier-version
run: >
echo "version=$(cat package.json | grep '\"prettier\": \"' |
cut -d ':' -f 2 | tr -d '"' | tr -d ' ' | tr -d ,)" >> $GITHUB_OUTPUT
- name: Get Prettier organize imports version
id: prettier-org-import-version
run: >
echo "version=$(cat package.json | grep '\"prettier-plugin-organize-imports\": \"' |
cut -d ':' -f 2 | tr -d '"' | tr -d ' ' | tr -d ,)" >> $GITHUB_OUTPUT
- name: Install Prettier
run: npm install --ignore-scripts prettier@${{ steps.prettier-version.outputs.version }}
- name: Install Prettier plugins
run: npm install --ignore-scripts --prefix=$(pwd) prettier-plugin-organize-imports@${{ steps.prettier-org-import-version.outputs.version }}
- name: Get base branch
id: base-branch
run: |
if [ "$GITHUB_REF" == "refs/heads/staging" ]; then
echo "base_branch=main" >> $GITHUB_OUTPUT
else
echo "base_branch=staging" >> $GITHUB_OUTPUT
fi
- name: Get changed directories
id: changed-dirs
run: |
changed=$(git diff --name-only origin/${{ steps.base-branch.outputs.base_branch }} --diff-filter=dr | grep -v "node_modules" | grep -vE "^\.husky" | cut -d/ -f1 | sort -u | tr "\n" " ")
echo "changed_dirs=$changed" >> $GITHUB_OUTPUT
- name: Run Prettier on changed directories
if: ${{ steps.changed-dirs.outputs.changed_dirs != '' }}
run: npx prettier --check ${{ steps.changed-dirs.outputs.changed_dirs }} --ignore-unknown