Action assumes "push" events triggered the last workflow run, which is not always true
This is a very useful action, however I have a use-case where I'm checking for a workflow run that was triggered by either a workflow_dispatch or workflow_run and the script always returns an empty commit hash, because it's hard coded to check for push events.
Ideally the workflow event type sent to the API can be optionally specified as an action input eg.:
octokit.actions
.listWorkflowRuns({
owner,
repo,
workflow_id: core.getInput("workflow_id"),
status: "success",
branch: core.getInput("branch"),
event: core.getInput("event") || "push",
})
To test a solution, I've forked this action and modified a v2 of this action to only specify event filter in the API call if an explicit workflow_event input is set. In this way, the action will return all successful workflow runs regardless of the event that triggered them
If users want to be specific about which event triggered the last workflow run, they can add the optional workflow_event input parameter to their action.
It would be great to have this added in! Having the same issue.
Test this action with my manual trigger workflow which relies on workflow event (on: workflow_dispatch). The action was not able to return any value while it used to work well with push event. There is a huge value can be add to this action if it is able to support workflow event. Cheers,
I'm having the same issue.
Thanks @simondotm for fixing that. I will try out our version.
However, would be cool to have that in the main repo.