New Crowdin updates #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Stats | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
manualTrigger: | |
description: 'Trigger the workflow manually' | |
required: false | |
default: 'true' | |
jobs: | |
update-stats: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Grant write access to the repository | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install requests | |
- name: Update mods count | |
run: python .github/scripts/count-mods.py | |
- name: Update packages count | |
run: python .github/scripts/count-pkgs.py | |
# Configure Git | |
- name: Configure Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
# Commit the updated badge files only if there are changes | |
- name: Commit changes if any | |
run: | | |
git add .github/badges/mods-badge.json | |
git add .github/badges/pkgs-badge.json | |
# Check if there are changes before committing | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update badges" | |
git push | |
fi |