diff --git a/.github/workflows/translation_status.yml b/.github/workflows/translation_status.yml new file mode 100644 index 00000000..402ce999 --- /dev/null +++ b/.github/workflows/translation_status.yml @@ -0,0 +1,43 @@ +name: Update translation guide status + +on: + workflow_dispatch: + schedule: + - cron: "0 3 1 * *" + +jobs: + update-dep: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Run script to update translation guide status + run: | + python -m pip install --upgrade pip + python -m pip install babel + python scripts/translation_stats.py + + - name: Create Pull Request + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore(translation): update translation guide status" + title: "chore(translation): update translation guide status" + body: | + This PR updates the translation guide status in the _static/translation_stats.json file. + + _Auto-generated by [create-pull-request][1]_ + + [1]: https://github.com/peter-evans/create-pull-request + branch: chore/update-translation-guide-status + add-paths: "_static/translation_stats.json" + delete-branch: true diff --git a/scripts/translation_stats.py b/scripts/translation_stats.py index 9988ae6f..6d5587ba 100644 --- a/scripts/translation_stats.py +++ b/scripts/translation_stats.py @@ -100,7 +100,9 @@ def main(): # Dump the results to a JSON file with open(STATIC_DIR / "translation_stats.json", "w") as f: import json - json.dump(results, f, indent=4) + json.dump(results, f, indent=2) + # Add an end-of-file newline + f.write("\n") if __name__ == "__main__": main()