statistics-schedule #1358
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: statistics-schedule | |
| on: | |
| schedule: | |
| - cron: "0 16 * * *" | |
| env: | |
| COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }} | |
| COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytz cos-python-sdk-v5 | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Run Python scripts | |
| run: | | |
| python ./update.py | |
| - name: Push back to repository | |
| run: | | |
| export TZ='Asia/Shanghai' | |
| git config --global user.email "openvpi@outlook.com" | |
| git config --global user.name "bot" | |
| git add . | |
| git commit -m "Statistics of $(date -d "1 day ago" +"%Y-%m-%d")" | |
| git push --force |