diff --git a/.github/workflows/2024_PyConDE_random_generator.yaml b/.github/workflows/2024_PyConDE_random_generator.yaml new file mode 100644 index 0000000..c5e8bb9 --- /dev/null +++ b/.github/workflows/2024_PyConDE_random_generator.yaml @@ -0,0 +1,27 @@ +name: Random Number Workflow +run-name: "MANUAL - 🔬 Show Default Env (run by - ${{ github.triggering_actor }})" + +on: + workflow_dispatch: + pull_request: + +jobs: + random-number-generator: + runs-on: ubuntu-latest + outputs: + number: ${{ steps.generate-number.outputs.number }} + is-even: ${{ steps.generate-number.outputs.is-even }} + steps: + - id: generate-number + run: echo "number=$((RANDOM))" >> $GITHUB_ENV + - id: is-even + run: | + echo "is-even=$(( ${{ steps.generate-number.outputs.number }} % 2 == 0 ))" >> $GITHUB_ENV + echo "The number is ${{ steps.generate-number.outputs.number }}" >> $GITHUB_ENV + + consumer-of-generator-odd: + needs: random-number-generator + runs-on: ubuntu-latest + if: ${{ needs.random-number-generator.outputs.is-even == 'false' }} + steps: + - run: echo "The number is ${{ needs.random-number-generator.outputs.number }} is odd"