From 491c9ae7bd11d1209890a0b1f1617e46dd4acc17 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Fri, 26 Jan 2024 15:33:02 -0800 Subject: [PATCH 1/2] chore: use dorny/path-filter for required status --- .github/workflows/motoko-counter-example.yaml | 29 +++++++++++++++---- .github/workflows/motoko-counter-skip.yaml | 20 ------------- 2 files changed, 24 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/motoko-counter-skip.yaml diff --git a/.github/workflows/motoko-counter-example.yaml b/.github/workflows/motoko-counter-example.yaml index 676825f57..9db86b532 100644 --- a/.github/workflows/motoko-counter-example.yaml +++ b/.github/workflows/motoko-counter-example.yaml @@ -4,16 +4,33 @@ on: branches: - master pull_request: - paths: - - motoko/counter/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-counter-example.yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + motoko-counter-example-darwin: ${{ steps.filter.outputs.sources }} + motoko-counter-example-linux: ${{ steps.filter.outputs.sources }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sources: + - motoko/counter/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/motoko-counter-example.yaml motoko-counter-example-darwin: + needs: changes + if: ${{ needs.changes.outputs.sources == 'true' }} runs-on: macos-12 steps: - uses: actions/checkout@v1 @@ -26,6 +43,8 @@ jobs: make test popd motoko-counter-example-linux: + needs: changes + if: ${{ needs.changes.outputs.sources == 'true' }} runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/motoko-counter-skip.yaml b/.github/workflows/motoko-counter-skip.yaml deleted file mode 100644 index 225e19575..000000000 --- a/.github/workflows/motoko-counter-skip.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: motoko-counter -on: - pull_request: - paths-ignore: - - motoko/counter/** - - .github/workflows/provision-darwin.sh - - .github/workflows/provision-linux.sh - - .github/workflows/motoko-counter-example.yaml -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - motoko-counter-example-darwin: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' - motoko-counter-example-linux: - runs-on: ubuntu-latest - steps: - - run: echo 'Not needed - relevant folder not touched' From 4970254322bb61ea32783a8842b65000e84fa1e4 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Fri, 26 Jan 2024 15:49:27 -0800 Subject: [PATCH 2/2] fix output name --- .github/workflows/motoko-counter-example.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/motoko-counter-example.yaml b/.github/workflows/motoko-counter-example.yaml index 9db86b532..562d7e181 100644 --- a/.github/workflows/motoko-counter-example.yaml +++ b/.github/workflows/motoko-counter-example.yaml @@ -15,8 +15,7 @@ jobs: pull-requests: read # Set job outputs to values from filter step outputs: - motoko-counter-example-darwin: ${{ steps.filter.outputs.sources }} - motoko-counter-example-linux: ${{ steps.filter.outputs.sources }} + sources: ${{ steps.filter.outputs.sources }} steps: # For pull requests it's not necessary to checkout the code - uses: dorny/paths-filter@v3