Skip to content

ci: autoupdating translation stats via PRs #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/translation_status.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion scripts/translation_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading