Triggering jobs
- The required
onkeyword describes the events that trigger workflows.
Single event
If the workflow is triggered by a single event then you can write it like this:
on: push
Multiple events
If you’d like to configure multiple events, you have several ways to do that.
on: [push, pull_request, workflow_dispatch]
You can also write:
on:
push:
pull_request:
workflow_dispatch:
- Run on “push” in every branch.
- Run on “pull_request” if it was sent to the “dev” branch.
workflow_dispatchto run manually via the web site of GitHub.- Scheduled every 5 minutes (cron config)
name: Triggers
on:
push:
branches: '*'
pull_request:
branches: 'dev'
workflow_dispatch:
schedule:
- cron: '*/5 * * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Look around
run: |
echo $GITHUB_EVENT_NAME
printenv | sort
- Manual events (via POST request)