Icarus
Icarus

Reputation: 135

GitHub Actions Job Based on Multiple Conditions from Inputs

I've been trying to create conditions for Jobs in GitHub Actions but I can't seem to get it working

I have the following Inputs:

on:
  workflow_dispatch:
    inputs:
      env:
        description: 'Select the Environment'
        type: choice
        required: true
        options:
        - SIT
        - UAT
      op:
        description: 'Deploy or Delete Apps'
        type: choice
        required: true
        options:
        - Deploy
        - Delete
      ver:
        description: 'Type the app version'
        required: true

and the below jobs:

jobs:
  create-sit-app:
    runs-on: ubuntu-latest
    name: 'Deploy App for SIT'
    if: |
      (${{ github.event.inputs.env }} == 'SIT' && ${{ github.event.inputs.op }} == 'Deploy')

    steps:
........
........
........

I also tried this

(${{ github.event.inputs.env == 'SIT' }} && ${{ github.event.inputs.op == 'Deploy' }})

And this

${{ github.event.inputs.env == 'SIT' }} && ${{ github.event.inputs.op == 'Deploy' }}

Upvotes: 1

Views: 5705

Answers (1)

Icarus
Icarus

Reputation: 135

Managed to do it like this:

    if: (github.event.inputs.env == 'SIT' && github.event.inputs.op == 'Deploy')

Upvotes: 5

Related Questions