Scrape Install Count #761
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: Scrape Install Count | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '30 14 * * *' # 每天北京时间22:30运行一次 | |
| # push: | |
| # branches: | |
| # - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| scrape: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y fonts-noto-cjk | |
| python -m pip install --upgrade pip | |
| pip install requests beautifulsoup4 matplotlib numpy scipy | |
| - name: Run scraper | |
| run: python .github/scripts/scraper.py | |
| - name: Generate graph | |
| run: python .github/scripts/generate_graph.py | |
| - name: Commit and push data | |
| run: | | |
| git config --local user.email "actions@github.com" | |
| git config --local user.name "GitHub Actions" | |
| if [ -f install_counts.json ]; then git add install_counts.json; fi | |
| if [ -f install_count.png ]; then git add install_count.png; fi | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "Update install count and graph" | |
| git push | |