[GH-ISSUE #332] How to trigger event: workflow_dispatch with inputs ? #234

Closed
opened 2026-03-01 21:41:39 +03:00 by kerem · 4 comments
Owner

Originally created by @cupen on GitHub (Aug 7, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/332

Here is a example, how to trigger it?

name: test

on:
  workflow_dispatch:
    inputs:
      name:
        description: "name"
        required: true
        default: "world"

jobs:
  show_inputs:
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo "Hello ${{ github.event.inputs.name }}!"
Originally created by @cupen on GitHub (Aug 7, 2020). Original GitHub issue: https://github.com/nektos/act/issues/332 Here is a example, how to trigger it? ```yml name: test on: workflow_dispatch: inputs: name: description: "name" required: true default: "world" jobs: show_inputs: runs-on: ubuntu-latest steps: - run: | echo "Hello ${{ github.event.inputs.name }}!" ```
kerem closed this issue 2026-03-01 21:41:39 +03:00
Author
Owner

@jasonmimick commented on GitHub (Aug 31, 2020):

Create a json file with the event payload & use the --eventpath flag.

$ cat sample.event
{
  "action": "workflow_dispatch",
  "inputs": {
      "name": "Mr. Bill"
  }
}
$ act --job show_inputs --eventpath sample.event
[test/show_inputs] 🚀  Start image=node:12.6-buster-slim
[test/show_inputs]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/show_inputs] ⭐  Run echo "Hello ${{ github.event.inputs.name }}!"
| Hello Mr. Bill!
[test/show_inputs]   ✅  Success - echo "Hello ${{ github.event.inputs.name }}!"
<!-- gh-comment-id:683904024 --> @jasonmimick commented on GitHub (Aug 31, 2020): Create a json file with the event payload & use the `--eventpath` flag. ``` $ cat sample.event { "action": "workflow_dispatch", "inputs": { "name": "Mr. Bill" } } $ act --job show_inputs --eventpath sample.event [test/show_inputs] 🚀 Start image=node:12.6-buster-slim [test/show_inputs] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [test/show_inputs] ⭐ Run echo "Hello ${{ github.event.inputs.name }}!" | Hello Mr. Bill! [test/show_inputs] ✅ Success - echo "Hello ${{ github.event.inputs.name }}!" ```
Author
Owner

@cupen commented on GitHub (Sep 2, 2020):

@jasonmimick Thank you very much.

<!-- gh-comment-id:685392941 --> @cupen commented on GitHub (Sep 2, 2020): @jasonmimick Thank you very much.
Author
Owner

@mfulgo commented on GitHub (Sep 24, 2024):

Per #1238, you have to specify workflow_dispatch at the command line. For example:

act workflow_dispatch --workflows '.github/workflows/test.yaml' --eventpath \
<( jq -n '{ inputs: { name: "Mr. Bill" } }' )

Otherwise, this triggers a push event, and ${{ inputs.name }} would not resolve.

<!-- gh-comment-id:2371581273 --> @mfulgo commented on GitHub (Sep 24, 2024): Per #1238, you have to specify `workflow_dispatch` at the command line. For example: ```bash act workflow_dispatch --workflows '.github/workflows/test.yaml' --eventpath \ <( jq -n '{ inputs: { name: "Mr. Bill" } }' ) ``` Otherwise, this triggers a `push` event, and `${{ inputs.name }}` would not resolve.
Author
Owner

@KalebCoberly commented on GitHub (Dec 9, 2024):

You can also use the --input flag:
act workflow_dispatch --workflows '.github/workflows/test.yaml' --input name="Mr. Bill"

<!-- gh-comment-id:2528488434 --> @KalebCoberly commented on GitHub (Dec 9, 2024): You can also use the `--input` flag: `act workflow_dispatch --workflows '.github/workflows/test.yaml' --input name="Mr. Bill"`
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#234
No description provided.