From 2b1f63cf2c3d5fa826ba0905115eb91a5c9d2c9b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 21 Oct 2023 22:41:00 +0200 Subject: [PATCH] feat(node-tests): Only run if required Signed-off-by: Ferdinand Thiessen --- workflow-templates/node-test.yml | 36 ++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/workflow-templates/node-test.yml b/workflow-templates/node-test.yml index e779d244..43b4fcde 100644 --- a/workflow-templates/node-test.yml +++ b/workflow-templates/node-test.yml @@ -16,9 +16,37 @@ concurrency: cancel-in-progress: true jobs: + changes: + runs-on: ubuntu-latest + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - '__tests__/**' + - '__mocks__/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.js' + - '**.ts' + - '**.vue' + test: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src != 'false' + steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -57,11 +85,15 @@ jobs: files: ./coverage/lcov.info summary: + permissions: + contents: none runs-on: ubuntu-latest - needs: test + needs: [changes, test] + if: always() name: test-summary + steps: - name: Summary status - run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi