From 683730721292cfd8fccf424ced8acbcc4d31b11b Mon Sep 17 00:00:00 2001 From: Muhammad Hammad <33136628+mhnaeem@users.noreply.github.com> Date: Tue, 5 Jul 2022 16:35:05 -0230 Subject: [PATCH] Improve docs for events inputs (#1238) * Added documentation on how to pass inputs for workflows that require them * Added the correct command to trigger the workflow Co-authored-by: Casey Lee --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 4186c06..66f90ed 100644 --- a/README.md +++ b/README.md @@ -370,6 +370,49 @@ act -e pull-request.json Act will properly provide `github.head_ref` and `github.base_ref` to the action as expected. +## Pass Inputs to Manually Triggered Workflows + +Example workflow file + +```yaml +on: + workflow_dispatch: + inputs: + NAME: + description: "A random input name for the workflow" + type: string + SOME_VALUE: + description: "Some other input to pass" + type: string + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Test with inputs + run: | + echo "Hello ${{ github.event.inputs.NAME }} and ${{ github.event.inputs.SOME_VALUE }}!" +``` + +Example JSON payload file conveniently named `payload.json` + +```json +{ + "inputs": { + "NAME": "Manual Workflow", + "SOME_VALUE": "ABC" + } +} +``` + +Command for triggering the workflow + +```sh +act workflow_dispatch -e payload.json +``` + # GitHub Enterprise Act supports using and authenticating against private GitHub Enterprise servers.