Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
- run: sudo apt-get install -y gettext
- run: uv run generate.py # generates "index.html"
- run: mkdir -p build && cp index.* style.css build
- run: cd build && cat index.json
- uses: actions/upload-artifact@v4
with:
name: build
path: build
- name: Deploy 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
20 changes: 19 additions & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@
generation_time = datetime.now(timezone.utc)


def get_previous_completion(language_code: str) -> float:
try:
with open('index.json') as f:
previous_data = json.load(f)
for item in previous_data:
if item['language']['code'] == language_code:
return item.get('completion', 0.0)
except FileNotFoundError:
pass
return 0.0


def get_completion_progress() -> Iterator['LanguageProjectData']:
with TemporaryDirectory() as clones_dir:
Repo.clone_from(
Expand Down Expand Up @@ -76,6 +88,10 @@ def get_project_data(
translators_data = TranslatorsData(0, False)
visitors_num = 0
branch = None

previous_completion = get_previous_completion(language.code)
change = completion - previous_completion

return LanguageProjectData(
language,
repo,
Expand All @@ -87,6 +103,7 @@ def get_project_data(
in_switcher=languages_built.get(language.code),
uses_platform=language.code in contribute.pulling_from_transifex,
contribution_link=contribute.get_contrib_link(language.code, repo),
change=change,
)


Expand All @@ -102,6 +119,7 @@ class LanguageProjectData:
in_switcher: bool | None
uses_platform: bool
contribution_link: str | None
change: float


if __name__ == '__main__':
Expand All @@ -118,4 +136,4 @@ class LanguageProjectData:
Path('index.html').write_text(output)
Path('index.json').write_text(
json.dumps(completion_progress, indent=2, default=asdict)
)
)
Loading