From f6363cfd974d9e28109c1e5124a44feeb4aca7d2 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Thu, 2 Nov 2023 10:53:27 -0500 Subject: [PATCH] Improve path-filtering rules on unit test action See docs about how jobs that are skipped still report "success", which is necessary for jobs that are required to succeed based on branch protection rules. https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution --- .github/workflows/nodejs.yml | 45 +++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4fe2b1236..aba6ad9fd 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,32 +1,35 @@ --- name: Node CI -on: - push: - paths-ignore: - - '**/*.md' - - '**/*.asciidoc' - - '**/*.txt' - - 'docs/**' - - '.ci/**' - - '.buildkite/**' - - 'scripts/**' - - 'catalog-info.yaml' - pull_request: - paths-ignore: - - '**/*.md' - - '**/*.asciidoc' - - '**/*.txt' - - 'docs/**' - - '.ci/**' - - '.buildkite/**' - - 'scripts/**' - - 'catalog-info.yaml' +on: [push, pull_request] jobs: + paths-filter: + name: Detect files changed + runs-on: ubuntu-latest + outputs: + skip: '${{ steps.changes.outputs.skip }}' + steps: + - uses: dorny/paths-filter/@v2.11.1 + id: changes + with: + filters: | + skip: + - '**/*.md' + - '**/*.asciidoc' + - '**/*.txt' + - 'docs/**' + - '.ci/**' + - '.buildkite/**' + - 'scripts/**' + - 'catalog-info.yaml' + test: name: Test runs-on: ${{ matrix.os }} + needs: paths-filter + # only run if files not in `skip` filter were changed + if: needs.paths-filter.outputs.skip != 'true' strategy: fail-fast: false