New Crowdin updates #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync from Crowdin | |
on: | |
pull_request_target: | |
paths: | |
- json-translated/** | |
concurrency: | |
group: from-crowdin-pr-${{ github.event.pull_request.id }} | |
cancel-in-progress: true | |
jobs: | |
sync: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout repo | |
uses: actions/[email protected] | |
with: | |
ref: crowdin-service-branch | |
# only run on PRs from Meadowsys (id 49562048) | |
# (Crowdin PRs look like they come from the user that set up the integration) | |
- name: authenticate | |
id: authenticate | |
run: | | |
if [ ${{ github.event.pull_request.user.id }} -eq 49562048 ] && [ ${{ github.event.pull_request.base.ref }} == "master" ] && [ ${{ github.event.pull_request.head.ref }} == "crowdin-service-branch" ]; then | |
echo "authenticated=true" >> $GITHUB_OUTPUT | |
else | |
echo "authenticated=false" >> $GITHUB_OUTPUT | |
fi | |
- name: setup pnpm (yes) | |
if: ${{ steps.authenticate.outputs.authenticated == 'true' }} | |
uses: pnpm/[email protected] | |
with: | |
version: "8.5.1" | |
# safe enough to assume that there will be changes? | |
- name: update and commit CSON from translated JSON | |
if: ${{ steps.authenticate.outputs.authenticated == 'true' }} | |
run: | | |
pnpm i | |
rm -rf cson-translated | |
node script/translated-json-to-cson.mjs | |
git config --global user.name smol | |
git config --global user.email [email protected] | |
echo "https://meadowsys:${{ secrets.GITHUB_TOKEN }}@github.com" > .git/credentials | |
git config --global credential.helper "store --file=.git/credentials" | |
git config --unset-all http.https://github.com/.extraheader # https://stackoverflow.com/a/69979203 | |
git add -A | |
git commit -m "(automated) updating CSON files from Crowdin translated JSON files" | |
git push |