Skip to content

Documentation for github.event objects #27058

Answered by MrSkwiggs
MrSkwiggs asked this question in Actions
Discussion options

You must be logged in to vote

I did manage to find how to do so by first adding a step to print out the github object.

steps:
  - name: Echo github obj
    run: echo ${{ toJson(github) }}

This allowed me to see that the github object contains an event_name key, which, in the case of a workflow_dispatch event, contains workflow_dispatch.

It was then very easy to modify my if clause to also check for this key.

my-job:
  runs-on: [ubuntu-latest]
  if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch'
  steps:
    # more steps

note: somehow using double quotes around "workflow_dispatch" in the if clause raises an error (Unknown identifier), so make sure to use single quotes

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@LucasMMota
Comment options

Answer selected
Comment options

You must be logged in to vote
3 replies
@wesleyscholl
Comment options

@believelody
Comment options

@chuckwondo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment