1 name: Should workflow run? 2 3 on: 4 workflow_call: 5 inputs: 6 commit-range: 7 description: Commits considered to determine bazel targets 8 required: false 9 type: string 10 default: HEAD^..HEAD 11 bazel-target-prefix: 12 description: Bazel target prefix used to determine if the code path will be used 13 required: true 14 type: string 15 16 outputs: 17 result: 18 description: "Boolean to be used in the job to decide if the job runs or not" 19 value: ${{ jobs.check_workflow_run.outputs.result }} 20 21 jobs: 22 check_workflow_run: 23 runs-on: ubuntu-latest 24 outputs: 25 result: ${{ steps.check-bazel-target-prefix.outputs.run-workflow }} 26 steps: 27 - name: Checkout source tree 28 uses: actions/checkout@v3 29 with: 30 fetch-depth: 50 31 - name: Setup Bazel 32 uses: p0deje/setup-bazel@0.2.0 33 with: 34 bazelisk-cache: true 35 external-cache: | 36 name: should-workflow-run 37 manifest: 38 crates: rust/Cargo.Bazel.lock 39 npm: package-lock.json 40 pypi__pip: py/requirements_lock.txt 41 rules_ruby_dist: rb/ruby_version.bzl 42 repository-cache: true 43 - name: Setup Java 44 uses: actions/setup-java@v3 45 with: 46 java-version: '11' 47 distribution: 'temurin' 48 - name: Check bazel target prefix 49 id: check-bazel-target-prefix 50 run: | 51 ./scripts/github-actions/should-workflow-run.sh 52 shell: bash 53 env: 54 BAZEL_TARGET_PREFIX: ${{ inputs.bazel-target-prefix }}