diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0fc612b..5ef4eb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,3 +41,19 @@ jobs: POEDITOR_PROJECT_ID: "715168" run: | python upload_terms.py + + # Run the download_terms.py script + python download_terms.py + + # Stage the downloaded translation files + git add locales/fr/LC_MESSAGES/docs.po + + # Check if there are any changes that are staged but not committed. + if [[ "$(git diff --cached --exit-code)" = "" ]]; then + echo "Nothing to commit, working tree clean"; + else + # Commit the changes + git commit -m "Auto update deafrica-tools french translation files" + # Update the branch + git push + fi diff --git a/download_translations.py b/download_translations.py index 20674d2..f022431 100755 --- a/download_translations.py +++ b/download_translations.py @@ -14,10 +14,9 @@ def download_translation(file_path, project_id, api_token): file_type='po', local_file=file_path, ) - if __name__ == '__main__': project_id = os.environ['POEDITOR_PROJECT_ID'] - api_token = os.environ['POEDITOR_API_TOKEN'] + api_token = os.environ['POEDITOR_API_TOKEN'] file_path = 'locales/fr/LC_MESSAGES/docs.po' print(f"Downloading translation to {file_path}")