From afaaff20a2498a9754ce10d4b6026f46729524f3 Mon Sep 17 00:00:00 2001 From: Artem Kislovskiy Date: Sat, 13 Apr 2024 22:21:10 +0200 Subject: [PATCH] add random generator --- .../2024_PyConDE_random_generator.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/2024_PyConDE_random_generator.yaml 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"