|
| 1 | +# Print Workflow Dispatch Inputs and Env Vars |
| 2 | + |
| 3 | +This GitHub Action prints all input values from a `workflow_dispatch` event to the log. Optionally, it can also print all environment variables. It's a simple and effective tool for debugging or verifying input values and environment settings in your manually triggered workflows. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Prints all `workflow_dispatch` inputs to the log |
| 8 | +- Optionally prints all environment variables |
| 9 | +- Minimal configuration required |
| 10 | +- Doesn't require a GitHub token |
| 11 | +- Lightweight and fast |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +To use this action in your workflow, add it as a step in your `workflow_dispatch` triggered workflow: |
| 16 | + |
| 17 | +```yaml |
| 18 | +name: Print Inputs and Env Vars Example |
| 19 | + |
| 20 | +on: |
| 21 | + workflow_dispatch: |
| 22 | + inputs: |
| 23 | + name: |
| 24 | + description: 'Your name' |
| 25 | + required: true |
| 26 | + type: string |
| 27 | + age: |
| 28 | + description: 'Your age' |
| 29 | + required: false |
| 30 | + type: number |
| 31 | + |
| 32 | +jobs: |
| 33 | + print-inputs-and-env: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Print Workflow Dispatch Inputs and Env Vars |
| 37 | + uses: shayki5/print-workflow-dispatch-inputs@v1 |
| 38 | + with: |
| 39 | + print_env_vars: 'true' # Set to 'true' to print environment variables |
| 40 | +``` |
| 41 | +
|
| 42 | +When you manually trigger this workflow and provide values for the inputs, the action will print these input values to the log. If `print_env_vars` is set to 'true', it will also print all environment variables. |
| 43 | + |
| 44 | +## Inputs |
| 45 | + |
| 46 | +| Input | Description | Required | Default | |
| 47 | +|-------|-------------|----------|---------| |
| 48 | +| `print_env_vars` | Whether to print environment variables | No | 'false' | |
| 49 | + |
| 50 | +## How it Works |
| 51 | + |
| 52 | +This action reads the event payload from the `GITHUB_EVENT_PATH` environment variable, which is automatically set by GitHub Actions. It then uses `jq` to extract and print the input values. If `print_env_vars` is set to 'true', it also prints all environment variables using the `env` command. |
| 53 | + |
| 54 | +## Requirements |
| 55 | + |
| 56 | +This action is designed to work with `workflow_dispatch` events. It will not print inputs for other event types, but can still print environment variables if enabled. |
| 57 | + |
| 58 | +## License |
| 59 | + |
| 60 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 61 | + |
| 62 | +## Contributing |
| 63 | + |
| 64 | +Contributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/shayki5/print-workflow-dispatch-inputs/issues). |
| 65 | + |
| 66 | +## Support |
| 67 | + |
| 68 | +If you encounter any problems or have any questions, please open an issue in this repository. |
0 commit comments