Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Action assumes "push" events triggered the last workflow run, which is not always true #1

Open
simondotm opened this issue Jun 22, 2021 · 4 comments

Comments

@simondotm
Copy link

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",
    })
@simondotm
Copy link
Author

simondotm commented Jun 22, 2021

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.

@psteinroe
Copy link

It would be great to have this added in! Having the same issue.

@kateluu-comdev
Copy link

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,

@pascalbe-dev
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants