Computer scienceSystem administration and DevOpsCI/CD processesGitHub Actions

Conditional execution

Even or Odd?

Report a typo

What is the output of the workflow file?

name: Even or Odd?
on: push
jobs:
  zeroone:
    runs-on: ubuntu-latest
    steps:
      - id: gen-num
        run: echo "num=22 % 2" 
      - if: steps.gen-num.outputs.num == 0
        run: echo "The number is even"
      - if: steps.gen-num.outputs.num == 1
        run: echo "The number is odd"
Enter a short text
___

Create a free account to access the full topic