Skip to content

VERY experimental Nintendo Switch 2 emulator

C++
1.6 KB
Raw Blame
name: tx-pull

on:
  #  monday at 4pm
  schedule:
    - cron: '0 16 * * 1'
  workflow_dispatch:

jobs:
  tx-update:
    runs-on: source
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Get New Translations
        run: tx-cli pull -t -f

      - name: Push branch
        run: |
          git config --local user.name "Eden CI"
          git config --local user.email "[email protected]"
          git config --local user.signingkey "D57652791BB25D2A"
          git config --local push.autoSetupRemote true

          git remote set-url origin ci:eden-emu/eden.git

          TIMESTAMP=$(date +"%s")
          echo "TIMESTAMP=$TIMESTAMP" >> "$GITHUB_ENV"

          git switch -c update-translations-$TIMESTAMP
          git add dist src/android/app/src/main/res

          git commit -sS -m "[dist, android] Update translations from Transifex"
          git push

      - name: Create PR
        run: |
          DATE=$(date +"%b %d")
          TITLE="[dist, android] Update translations from Transifex for $DATE"
          BODY="Automatic translation update for $DATE"
          BASE=master
          HEAD=update-translations-$TIMESTAMP

          cat << EOF > data.json
          {
            "base": "$BASE",
            "body": "$BODY",
            "head": "$HEAD",
            "title": "$TITLE"
          }
          EOF

          curl -XPOST \
            'https://git.eden-emu.dev/api/v1/repos/eden-emu/eden/pulls' \
            -H 'accept: application/json' \
            -H 'Authorization: Bearer ${{ secrets.CI_FJ_TOKEN }}' \
            -H 'Content-Type: application/json' \
            -d "@data.json" --fail