Yaml errors with multiple triggers

I’ve got my first action working and successfully running using a cron schedule.

I’d like it to also trigger on pushes, which would making testing much easier than the whole change the cron trigger time, wait for wall clock time, wait for GitHub execution time, rinse and repeat dance. I found the following syntax suggestion as an accepted answer in another thread:

on:
  push
  schedule:
    - cron: "22 12 * * *"

however, when adding the new push line, an error marker appears at the end of the schedule line: bad indentation of a mapping entry.

that error is confirmed via a yaml validator, which validates the following:

on:
  push
schedule:
    - cron: "22 12 * * *"

however when entering said ‘valid’ yaml, GitHub then flags the schedule keyword with
unknown key schedule.

so, I’m stuck between a rock and a hard place, where the ‘correct’ yaml syntax is illegal actions syntax, however the apparently correct actions syntax is being flagged as bad yaml.

halp!

You are missing a colon after push to make it a mapping key:

on:
  push:
  schedule:
    - cron: "22 12 * * *"
1 Like

indeed, that was the issue. thank you very much!

1 Like