Skip to content

Update translations #819

Update translations

Update translations #819

Workflow file for this run

name: "Update translations"
on:
workflow_dispatch:
schedule:
- cron: '38 6 * * *'
permissions:
contents: read
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git clone --depth=1 --branch snapshot https://github.com/folio-org/platform-complete build
- run: cp build/yarn.lock .
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Build translations
run: |
cd build
yarn config set @folio:registry https://repository.folio.org/repository/npm-folio/
CXXFLAGS="-std=c++17" yarn install
NODE_ENV=production yarn build output
- name: Merge translations
run: |
cd platform-complete
for oldfile in *.json ; do
newfile=$(echo $oldfile | sed -E 's#(.+).json#\1-*.json#')
newfile=$(echo ../build/output/translations/$newfile)
if [ ! -e "$newfile" ] ; then
echo "Skipping, not found: $newfile"
continue
fi
jq -s --sort-keys '.[0] * .[1]' $oldfile $newfile > /tmp/new.json
FILESIZE=$(stat -c%s /tmp/new.json)
if [ "$FILESIZE" -lt "1000000" ] ; then
echo "Skipping $LANG, file size must be >= 1000000 but it is $FILESIZE"
continue
fi
mv /tmp/new.json $oldfile
done
- uses: actions/upload-artifact@v4
with:
name: platform-complete
path: platform-complete/
retention-days: 1
commit:
needs: [update]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- run: rm -r platform-complete/
- uses: actions/download-artifact@v4
- name: Commit updates
run: |
git config --local user.name 'folio-translations repository bot'
git config --local user.email 'folio-translations@users.noreply.github.com'
git add platform-complete/
(git commit -m "Update translations" && git push) || true # ignore failure caused by unchanged files