Check which event triggered the workflow

Well, I’d like to know if it’s possible to know which event triggered the workflow. I mean, my yaml file is like this:

name: test

on:
  workflow_dispatch:
  pull_request:
    branches:
      - main

jobs:
  test:
    if: ${{ }}
# and so on

In the line where I created the if, I’d like to check what event triggered file/workflow/job, the workflow_dispatch OR the pull_request.

Thanks!

You can check the event type like this:

    if: ${{ github.event_name == 'pull_request' }}
1 Like

that’s exactly what i was looking for, thanks!

Btw, where can I find what values each property of github. can be? I mean, if I use ${{ github. }}, what can I use after the dot?

2 Likes