Update schedule #1548
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 schedule' | |
| # ⚠️注意:请不要在 fork 的仓库中添加 `on: schedule` 定时任务(cron)。 | |
| # Forks 可能被大量复制并触发定时执行,当前 GitHub Actions 资源使用已接近上限, | |
| # 大量 fork 的定时任务可能导致工作流被禁用。若需要定时执行,请使用其它部署方式。 | |
| # | |
| # ⚠️NOTICE: Do NOT add `on: schedule` cron triggers in forked repositories. | |
| # Forks may multiply scheduled runs and GitHub Actions resource usage is near limits. | |
| # Many scheduled workflows from forks can cause workflows to be disabled. | |
| # If scheduled execution is required, use other deployment methods. | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| push: | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| matrix: | |
| operating-system: [ 'ubuntu-latest' ] | |
| steps: | |
| - name: Set branch name | |
| id: vars | |
| run: echo "BRANCH_NAME=${{ github.repository_owner == 'Guovin' && 'gd' || 'master' }}" >> $GITHUB_ENV | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ env.BRANCH_NAME }} | |
| - name: Run with setup-python 3.13 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.13' | |
| update-environment: true | |
| cache: 'pipenv' | |
| - name: Install FFmpeg | |
| run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
| - name: Install pipenv | |
| run: pip3 install --user pipenv | |
| - name: Install dependecies | |
| run: pipenv --python 3.13 && pipenv install --deploy | |
| - name: Update | |
| run: pipenv run dev | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| if ! git diff --staged --quiet; then | |
| git commit -m "Github Action Auto Updated" | |
| git push --force | |
| fi |