Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unsupported event: push #32

Closed
sosedoff opened this issue Feb 13, 2019 · 8 comments
Closed

Error: unsupported event: push #32

sosedoff opened this issue Feb 13, 2019 · 8 comments

Comments

@sosedoff
Copy link
Contributor

I'm playing around with an action that runs when a PR is created, however with act command i'm getting this error (running act):

Error: unsupported event: push

Example workflow file:

workflow "test" {
  on = "pull_request"
  resolves = ["build"]
}

action "build" {
  uses = "./pull-request-action"
}

Im not sure why the error refers to push event

@sosedoff
Copy link
Contributor Author

Just realized that act uses push as a default event. When i execute act pull_request everything works as expected.

Perhaps act could check the workflow file for the event type and run it instead of using a default push event.

@cplee
Copy link
Contributor

cplee commented Feb 14, 2019

@sosedoff this was intentional, based on the fact that GH actions uses the push event as the default as per the docs

image

@cplee
Copy link
Contributor

cplee commented Feb 14, 2019

I'd be open for a PR if you have something else in mind!

@sosedoff
Copy link
Contributor Author

Yeah, i'll experiment a bit on this front. Also, i think i had an older version of act installed, once i updated it no longer printed any errors and terminated silently.

@mcolyer
Copy link

mcolyer commented Feb 14, 2019

@sosedoff this was intentional, based on the fact that GH actions uses the push event as the default as per the docs

This might have been unintentional on our part. I believe we used the word default here to mean that it's the default event that is selected within the workflow editor. It doesn't really have any significance beyond that. Having support for other events in act is definitely encouraged.

@cplee cplee reopened this Feb 14, 2019
@cplee
Copy link
Contributor

cplee commented Feb 14, 2019

So act does support running other events, but I do like @sosedoff suggestion. Let's keep this open and implement.

@sosedoff
Copy link
Contributor Author

sosedoff commented Feb 15, 2019

Ok so i played with workflows a bit more and realized that you can actually have more than one workflow in the same file triggered on the same event (push). Im thinking act could do the following (to eliminate extra typing):

  • Read the workflow file
  • If the workflow file contains only a single workflow - detect the event type
  • If user did not provide an event we could use the value defined with on instead of default push

So if i had a workflow like this:

workflow "dummy" {
  on = "pull_request"
  resolves = ["task"]
}
// ...

Running act would result in equivalent of act pull_request. If there are more than one type of events defined in the workflow act would use the existing behavior.

@cplee
Copy link
Contributor

cplee commented Feb 17, 2019

fixed with #35

@cplee cplee closed this as completed Feb 17, 2019
makrsmark pushed a commit to makrsmark/act that referenced this issue Aug 3, 2023
This reverts commit 1ba076d.

`EraseNeeds` Shouldn't be used in `jobparser.Parse`, it's for https://github.com/go-gitea/gitea/blob/023e61e678dc353fa6c9b0299c37f48e98a3c7af/models/actions/run.go#L200

Or Gitea won't be able to get `Needs` of jobs.

Reviewed-on: https://gitea.com/gitea/act/pulls/32
Reviewed-by: Zettat123 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants