From 8b606a1af19cfc72bc612b8381410dbf1137eaf6 Mon Sep 17 00:00:00 2001 From: scb261 <65343233+scb261@users.noreply.github.com> Date: Sun, 17 Jul 2022 18:27:26 +0300 Subject: [PATCH] [skip ci] Skip some build checks in PRs (#12608) * [skip ci] Skip some build checks in PRs * Remove unused line * [skip ci] Move parsing to the prepare job, make names more consistent --- .github/workflows/build_pull_request.yml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 5b0f9b8f1..25852a485 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -15,6 +15,8 @@ jobs: outputs: individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }} multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }} + isIndividualChanged: ${{ steps.parse-changed-files.outputs.isIndividualChanged }} + isMultisrcChanged: ${{ steps.parse-changed-files.outputs.isMultisrcChanged }} env: CI_MODULE_GEN: true steps: @@ -61,9 +63,33 @@ jobs: core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] }); core.setOutput('multisrcMatrix', { 'chunk': [...Array(numMultisrcChunks).keys()] }); + - id: get-changed-files + name: Get changed files + uses: jitterbit/get-changed-files@v1 + + - id: parse-changed-files + name: Parse changed files + run: | + isIndividualChanged=0 + isMultisrcChanged=0 + for changedFile in ${{ steps.get-changed-files.outputs.all }}; do + if [[ ${changedFile} == src/* ]]; then + isIndividualChanged=1 + elif [[ ${changedFile} == multisrc/* ]]; then + isMultisrcChanged=1 + else + isIndividualChanged=1 + isMultisrcChanged=1 + break + fi + done + echo "::set-output name=isIndividualChanged::$isIndividualChanged" + echo "::set-output name=isMultisrcChanged::$isMultisrcChanged" + build_multisrc: name: Build multisrc modules needs: prepare + if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }} runs-on: ubuntu-latest strategy: matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }} @@ -97,6 +123,7 @@ jobs: build_individual: name: Build individual modules needs: prepare + if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }} runs-on: ubuntu-latest strategy: matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}