GitHub Actions 定时任务无法触发

MaxLHy0424
30 1

新创建(昨天创建)的仓库,.github/workflows 下放着 Actions 的 YAML 文件,设置的是北京时间 00:00 自动运行,然而 GitHub Actions 在那个时候并没有运行,今天尝试改成 5 分钟运行一次,也没有用。

YAML 文件:

name: Sync SCLTK-Website
on:
  workflow_dispatch:
  schedule:
    - cron: '0 16 * * *'
permissions:
  contents: write
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout current repository
        uses: actions/checkout@v7
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          persist-credentials: true
      - name: Checkout SCLTK-Website
        uses: actions/checkout@v7
        with:
          repository: MaxLHy0424/SCLTK-Website
          # 如需私有仓库,请取消注释并配置 PAT
          # token: ${{ secrets.PAT_TOKEN }}
          path: SCLTK-Website-Mirror
          # ref: main   # 如需指定分支可取消注释
      - name: Copy to 'public' folder
        run: |
          mkdir -p public
          rm -rf public/*
          cp -r SCLTK-Website-Mirror/. public/
          rm -rf SCLTK-Website-Mirror
          rm -rf public/.git
      - name: Commit and push changes
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add public/
          git diff --staged --quiet || git commit -m "Sync SCLTK-Website $(date +'%Y-%m-%d %H:%M:%S')"
          git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
          git push
Where All Miracle Begins. 博客萌备
最新回复 ( 1 )
  • 2
    0
    滚来滚去……~(~o ̄▽ ̄)~o 。。。滚来滚去……o~(_△_o~) ~。。。
  • 游客
    3

    您需要登录后才可以回帖

    登录 注册

发新帖