Some jobs shouldn't run on every push: a report, a fix-up, a deploy someone decides on. workflow_dispatch runs a workflow when you start it, and inputs: asks for values:
name: Price check
on:
workflow_dispatch:
inputs:
monster:
required: true
jobs:
price:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: ./price.sh ${{ inputs.monster }}${{ inputs.monster }} is an expression: GitHub puts the input's value there before the step runs.
gh workflow run
Starts a workflow_dispatch workflow on the default branch, here main. Each -f gives one input.
Save it as .github/workflows/price.yml, push it, then:
gh workflow run price.yml -f monster=dragonIt prints the new run's ID. When the run is done, --log shows every step's log, not only failed ones:
gh run view <run-id> --logObjectives
- Start a workflow by hand.
- Look up the dragon's price.