Github动作`on`中未定义任何事件触发器

时间:2020-07-21 12:08:37

标签: github yaml pipeline github-actions

我创建了一个管道,每次按下任何分支时都想触发

有我的default.yml

name: default

on:
  push:
    branches:
    - '*'

jobs:
  build:
    runs-on: macOS-latest
    
    steps:
    - uses: actions/checkout@v1
    - name: CocoaPod Install
      run: pod install
    - name: Force xcode version
      run: sudo xcode-select -switch /Applications/Xcode_11.2.1.app
    - name: Build
      run: ./pipelines.sh build

当我在github上推送它时,我遇到了这个错误

on中未定义任何事件触发器

enter image description here

2 个答案:

答案 0 :(得分:2)

您可以仅通过使用

来触发所有分支
on: push

https://docs.github.com/en/actions/reference/events-that-trigger-workflows#example-using-a-single-event

删除-'*'

您的工作流程文件似乎正常。您检查了所有缩进吗?

答案 1 :(得分:0)

对于它的价值,我也不确定是什么导致了这个错误。似乎是语法或解析错误的某种组合被一个不太有用的错误所掩盖。

对我来说

  • 检查空格
  • 确保注释块和事件块之间有换行符
  • paths切换到paths-ignore

其中一件事为我修复了它。

enter image description here