name: crontab # 触发条件 on: schedule: # - cron: '0 3,12 * * *' # 表达式生成 https://crontab.guru/ - cron: '*/30 0-15 * * *' workflow_dispatch: env: # 设置环境变量 TZ: Asia/Shanghai jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: cache uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/run_in_Actions/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Timezone run: sudo timedatectl set-timezone 'Asia/Shanghai' - name: requirements run: | pip install -r ./utils/freev2/requirements.txt - name: main.py run: | python ./utils/freev2/main.py - name: Push run: | git pull origin main git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" git add ./sub git add ./utils git commit -m "$(date '+%Y.%m.%d %H:%M:%S') 更新机场订阅" || true git push origin main || true