Taufik Pirjade
Taufik Pirjade

Reputation: 440

can i have multiple 'on' in single GitActions workflow file?

I want to have the multiple on in single git workflow file life following. is this possible and if yes is it a good practice ?

on:
  schedule:
    - cron:  '30 5,17 * * *'
    
jobs 
-----

on:
  push:
    branches: 

jobs
-----

Upvotes: 6

Views: 4971

Answers (1)

rethab
rethab

Reputation: 8443

It is not possible like you do it, but what you can do is something like this:

on:
  push:
    branches:
  schedule:
    - cron:  '30 5,17 * * *'

jobs:
  my_job:
    if: github.event_name == 'push'

However if your jobs are distinct, I'd suggest putting them into different files.

Upvotes: 6

Related Questions