From 880452ef2bd311e7705ad069094ec72b0eee22bf Mon Sep 17 00:00:00 2001 From: Gouenji Shuuya <65014251+gouenji-shuuya@users.noreply.github.com> Date: Sun, 25 Sep 2022 21:50:57 +0530 Subject: [PATCH] Use GitHub Action to fetch translations from Transifex daily Everyday around 00:00 UTC (+/- some offset), this action will fetch translations from Transifex and commit them if there are any changes. This action will also be triggered by: - Updates to Python files - Updates to this file. - Manually from actions page. TRANSIFEX_API_TOKEN must be set up as a secret in the repository. --- .github/workflows/actions.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..d1f6086 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,51 @@ +name: Clerk work + +on: + schedule: # Daily schedule. + - cron: 0 0 * * * + + workflow_dispatch: {} # For manual switch in actions page. + + push: # Run on update to py files or this file on the main branch. + branches: + - main + paths: + - "**.py" + - ".github/workflows/action.yml" +# End of on. + + +jobs: + scheduled: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + cache: "pip" + run: pip install -r requirements.txt + + - name: Run update script + run: python3 fetch_latest.py + env: + TRANSIFEX_API_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }} + + - name: Commit changes (if any) + run: | + if [[ $(git status -s) ]]; then + git config user.name github-actions + git config user.email github-actions[bot]@users.noreply.github.com + git add . + git commit -m "Auto fetch: $(date +'%Y-%m-%d %R')" + git push + fi + # End of steps. + # End of scheduled. +# End of jobs. + + +# End of file.