[GH-ISSUE #484] Event type auto-detection not working #333

Closed
opened 2026-03-01 21:42:26 +03:00 by kerem · 3 comments
Owner

Originally created by @edtan on GitHub (Jan 17, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/484

The event type auto-detection is not working as intended - it is always defaulting to push, even though the workflow defines a different event type. For example, when running act for the following workflow, nothing happens. You must run act workflow_dispatch in order for it to run.

name: "Test auto-detection"
on: workflow_dispatch

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
     - name: "foo"
       run: echo "bar"

It looks like this is happening due to #157: PlanEvent("push") is never nil, because PlanEvent always creates and returns a new Plan object: github.com/nektos/act@e6fcfed458/pkg/model/planner.go (L108-L122).

Originally created by @edtan on GitHub (Jan 17, 2021). Original GitHub issue: https://github.com/nektos/act/issues/484 The event type auto-detection is not working as intended - it is always defaulting to `push`, even though the workflow defines a different event type. For example, when running `act` for the following workflow, nothing happens. You must run `act workflow_dispatch` in order for it to run. ``` name: "Test auto-detection" on: workflow_dispatch jobs: test: runs-on: ubuntu-latest steps: - name: "foo" run: echo "bar" ``` It looks like this is happening due to #157: `PlanEvent("push")` is never `nil`, because `PlanEvent` always creates and returns a new `Plan` object: https://github.com/nektos/act/blob/e6fcfed458dbccd640e093bffd0fc258d6ce0e6e/pkg/model/planner.go#L108-L122.
kerem 2026-03-01 21:42:26 +03:00
Author
Owner

@catthehacker commented on GitHub (Jan 17, 2021):

@edtan There is no auto-detection of event. It always defaults to push as it supposed to. You can see that in https://github.com/nektos/act#commands

# List the actions for a specific event:
act workflow_dispatch -l

# Run the default (`push`) event:
act
<!-- gh-comment-id:761902322 --> @catthehacker commented on GitHub (Jan 17, 2021): @edtan There is no auto-detection of event. It always defaults to push as it supposed to. You can see that in https://github.com/nektos/act#commands ``` # List the actions for a specific event: act workflow_dispatch -l # Run the default (`push`) event: act ```
Author
Owner

@edtan commented on GitHub (Jan 18, 2021):

Oh I see. Then I think this part of the code is no longer needed, but it could be a useful feature to have:
github.com/nektos/act@e6fcfed458/cmd/root.go (L152-L157)

<!-- gh-comment-id:761906210 --> @edtan commented on GitHub (Jan 18, 2021): Oh I see. Then I think this part of the code is no longer needed, but it could be a useful feature to have: https://github.com/nektos/act/blob/e6fcfed458dbccd640e093bffd0fc258d6ce0e6e/cmd/root.go#L152-L157
Author
Owner

@catthehacker commented on GitHub (Jan 18, 2021):

I looked at the code now and see what you meant, it can be an opt-in option enabled by flag.

<!-- gh-comment-id:761906595 --> @catthehacker commented on GitHub (Jan 18, 2021): I looked at the code now and see what you meant, it can be an opt-in option enabled by flag.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#333
No description provided.