Update Package Downloads #1
This file contains hidden or 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 Package Downloads | |
on: | |
schedule: | |
# Run every Sunday at 11:59 PM UTC | |
- cron: "59 23 * * 0" | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
generate-downloads: | |
name: Generate package download counts | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set up Python 3.13 + uv | |
uses: "./.github/actions/uv_setup" | |
with: | |
python-version: "3.13" | |
- name: Install dependencies | |
run: | | |
uv sync --group test | |
- name: Update download counts | |
run: | | |
uv run .github/scripts/packages_yml_get_downloads.py | |
- name: Upload updated packages.yml as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages-yml | |
path: reference/packages.yml | |
retention-days: 1 | |
commit-downloads: | |
name: Commit updated download counts | |
needs: generate-downloads | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Download updated packages.yml | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages-yml | |
path: reference/ | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add reference/packages.yml | |
# Only commit if there are changes | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "$(cat <<'EOF' | |
chore: update package download counts | |
π€ Automated update of package download statistics from pepy.tech | |
Generated with GitHub Actions workflow update-package-downloads.yml | |
EOF | |
)" | |
git push | |
fi |