Computer scienceSystem administration and DevOpsCI/CD processesGitHub Actions

Conditional execution

Wage

Report a typo

What is the output of this workflow?

name: calculate_wage
on: push
env:
  hourly_wage: 25
jobs:
  weekly:
    runs-on: ubuntu-latest
    outputs:
      output_1: ${{ steps.step1.outputs.weekly_wage }} 
    env:
      hours: 40
    steps:
      - id: step1
        run: echo "weekly_wage=$((${{ env.hourly_wage }} * ${{ env.hours }}))" >> $GITHUB_OUTPUT
  overtime:
    runs-on: ubuntu-latest
    outputs:
      output_2: ${{ steps.step1.outputs.overtime_wage }} 
    env:
      overtime: 15
    steps:
      - id: step1
        run: echo "overtime_wage=$((${{ env.hourly_wage }} * ${{ env.overtime }}))" >> $GITHUB_OUTPUT
  total_wage:
    runs-on: ubuntu-latest
    needs: [weekly, overtime]
    steps:
      - name: total
        run: echo $((${{needs.weekly.outputs.output_1}} + ${{needs.overtime.outputs.output_2}}))
Enter a number
___

Create a free account to access the full topic