Github actions Inputs and types of inputs
Inputs will suppourt three different contexts
- workflow_dispatch : manual tigger /api trigger
- workflow_call (reuseful workflow)
- composite actions (reuseful actions)
Types of inputs:
- string – input as simple text Ex: devlopment , org, …etc
- number/integer – inputs integer or floot value Ex: 1, 1.0.0
- choice – list of string need select option Ex:
- dev
- stage
- int
- prod
- boolen: true/false or yes/no
- Enviroment
name: manual jobs
on:
workflow_dispatch:
inputs:
enviroment:
description: demo
required: true
type: string
default: "dev"
allow-run:
description: allow to run steps
required: true
type: boolean
default: true
data_env:
description: allow to run steps
required: true
type: choice
options:
- dev
- stg
- prod
- int
default: dev
value:
description: demo
required: true
type: number
default: 1000
jobs:
demo-inpts:
runs-on: ubuntu-latest
steps:
- name: checkout repo branch
uses: actions/checkout@v7
- name: print values inputs
run: |
echo "env: ${{ github.event.inputs.enviroment }}"
- name: allow-run true
if: ${{ github.event.inputs.allow-run == true }}
run:
echo "Build started"
- name: demp choice inputs
run: |
echo "my data env is ${{ github.event.inputs.data_env }}"
echo "${{ github.event.inputs.value }}"
task:
- create new workflow add inputs
- env – choice inputs
- docker_image_name – string
- reponame – choice input
- normal repo
- snapshort
- image_version – number 120
- push true – blooen input
FROM ubuntu-latest
