“Github Actions” supplies a special event for workflows that can be triggered manually from the web interface. This event is workflow_dispatch. By default, it has only one input parameter: git branch that must be a context for the workflow execution. But the set of input parameters can be extended with custom ones.
The syntax is following:
on:
  workflow_dispatch:
    inputs:
      test-run:
        description: 'Test (y/n)?'
        required: true
        default: 'y'
And later on, the values of the inputs can be used as conditions for workflow steps:
jobs:
  build:
    steps:
      - name: Yes branch
        if: github.event.inputs.test-run == 'y'
        run: echo "Test = Y"
The sample workflow can be found on GitHub.
 


Be First to Comment