Is it possible to know the event type that is triggering github action?

I know that using ${{ github.event_name }}, I can see what is the event(e.g issue/push/pull_request, etc) that’s triggering the workflow.

However, if I want to know if an issue that is triggering, is it due to created/reopened/closed, is there any expression that works?

You can get more information about the action type with ${{ github.event.action }}, see e.g. the pull_request payload:

https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request

This works analogous with issues, issue_comment and other events.

//edit: action is a property of github.event, not github.event.pull_request or similar.

Thank you for your reply.

I tried using ${{ github.event.issues.action }}, but there is no output from this expression.
Am i using the wrong expression?

What trigger do you use for that workflow?

My bad, it’s a property of the event object, so this should work: ${{ github.event.action }}

I use issues open, closed, reopen, release, push, and pull_request to trigger telegram messages

Thank you so much! This works like a charm!

1 Like