github - 如何在 GitHub 工作流程中安排和推送/拉取请求事件?

标签 github github-actions

如果 push/pull_request 事件被触发,我想运行一个工作流当一个调度事件被触发时...

这是我的问题(语法问题).github/workflows/docker.yml:

name: Docker

on: [push, pull_request]
  schedule:
    # min hours day(month) month day(week)
    - cron: '0 0 */5 * *'

...

不幸的是这个语法是错误的,这里是错误:

Invalid workflow file
You have an error in your yaml syntax on line 3

最佳答案

根据文档:

Example using multiple events with activity types or configuration
If you need to specify activity types or configuration for an event, you must configure each event separately. You must append a colon (:) to all events, including events without configuration.

引用:https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-multiple-events-with-activity-types-or-configuration

所以这里我们不能使用事件列表...

name: Docker

on: 
  push:
  pull_request:
  schedule:
    # min hours day(month) month day(week)
    - cron: '0 0 */5 * *'

...

关于github - 如何在 GitHub 工作流程中安排和推送/拉取请求事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63581746/

相关文章:

Java 8 : How to use javadoc aggregate

github - 在 GitHub 上为我的 ssh key 创建密码

GitHub Actions 矩阵而不使用单独的作业?

docker - Github Actions中的Vuejs到Docker容器

google-chrome-extension - Puppeteer 无法在 GitHub 操作中启动

continuous-integration - GitHub Actions 在推送到所有分支时运行

git - 如何修复 GitHub pull 请求中被 git rebase 破坏的提交顺序?

Git - 远程 : fatal: You are on a branch yet to be born

带有 bup 的 git 附件

version-control - 将代码从Git/Bitbucket更新到实时服务器