Skip to content

Commit

Permalink
Use GitHub Action to fetch translations from Transifex daily
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gouenji-shuuya committed Sep 25, 2022
1 parent 77e2143 commit 6a939b8
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/actions.yml
@@ -0,0 +1,53 @@
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"

- name: Install dependencies
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.

0 comments on commit 6a939b8

Please sign in to comment.