FR: Set event payload when running locally #623

Open
opened 2024-11-14 12:35:06 +00:00 by stefanfaur · 0 comments
stefanfaur commented 2024-11-14 12:35:06 +00:00 (Migrated from gitea.com)

I am running my actions locally using act_runner to test them as such:

act_runner exec -j build-push-deploy -W .gitea/workflows/build-push-deploy.yaml --event '{"ref": "refs/tags/v1.0.0"}'
  • in this command above, {"ref": "refs/tags/v1.0.0"} is only being parsed as being the event name, not the actual payload. I have found no way to set event payload as well.

This limitation makes it difficult to simulate events like:

  • Tag push events: Where ref of event must be set.
  • workflow_dispatch events: Where setting the inputs object is required.

workflow_dispatch is currently ignored in Gitea, but is set to release in 1.23(Dec2024) as seen in this PR.

Proposed Solution:

Add an --eventpath flag, similar to what act provides (see this issue). This would allow specifying a file containing the event payload for more complex scenarios.

I would love to know is there is any way, even if hacky, to set the event payload when running locally.

Environment:

act_runner version: v0.2.8 (also tested on master built today 14.11.2024)
Testing on: macOS ARM64

I am running my actions locally using `act_runner` to test them as such: ```bash act_runner exec -j build-push-deploy -W .gitea/workflows/build-push-deploy.yaml --event '{"ref": "refs/tags/v1.0.0"}' ``` - in this command above, `{"ref": "refs/tags/v1.0.0"}` is only being parsed as being the event name, not the actual payload. I have found no way to set event payload as well. This limitation makes it difficult to simulate events like: - **Tag push events:** Where `ref` of event must be set. - **`workflow_dispatch` events:** Where setting the `inputs` object is required. `workflow_dispatch` is currently ignored in Gitea, but is set to release in 1.23(Dec2024) as seen in [this PR](https://github.com/go-gitea/gitea/pull/28163). #### Proposed Solution: Add an --eventpath flag, similar to what act provides (see [this issue](https://github.com/nektos/act/issues/332)). This would allow specifying a file containing the event payload for more complex scenarios. **I would love to know is there is any way, even if hacky, to set the event payload when running locally.** #### Environment: act_runner version: v0.2.8 (also tested on master built today 14.11.2024) Testing on: macOS ARM64
Sign in to join this conversation.
No description provided.