【发布时间】:2021-03-15 20:34:39
【问题描述】:
我有一个 Github Actions 工作流,它每小时触发一次。
虽然工作流确实运行,但它不会在计划的时间运行,即它不会按小时运行。有可能超过 30 分钟的延迟。我不知道这是为什么。
这不是工作流本身,因为它是在我手动运行大约 30 秒时执行的。
谁能告诉我是什么导致了延迟?
这是时区问题吗?即便如此,两次连续的工作流运行之间应该有 1 小时的固定间隔,但事实并非如此。
这是代码。
# This is a basic workflow to help you get started with Actions
name: Email every hour
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 */1 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run script to send email
- name: Run script
run: python emailer.py
env:
EMAIL_USER: ${{ secrets.EMAIL_USER }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
TO_EMAIL: ${{ secrets.TO_EMAIL }}
【问题讨论】:
-
我现在遇到这个问题,你有没有找到解决方案/解释?
-
@gowerc 这个问题在几天后以某种方式解决了。我猜这个问题出在 Github 上。现在,代码按时运行,每小时运行一次。跑步之间有大约一个小时的间隔。
-
我也有同样的问题,也在寻找答案
-
我联系了 gh 支持,他们说他们知道,但他们的公共路线图上没有任何内容
-
注意:但是,运行计划作业的最短时间已更改为 5 分钟。换句话说,
* * * * *的 cron 作业不会每分钟运行一次,而是 5 分钟。
标签: python time cron github-actions