From b142b10e2df9f4dfe8d80161403c76efb58f7744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Lef=C3=A9v=C3=A8re-Laoide?= Date: Mon, 21 Oct 2024 20:57:44 +0200 Subject: [PATCH 1/2] do not calculate coverage on external PRs --- .github/workflows/frontend.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index d3efebb5cd..bdcad95976 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -66,11 +66,12 @@ jobs: if: steps.cache-gui-fe-build.outputs.cache-hit != 'true' run: npm ci - - if: steps.cache-gui-fe-build.outputs.cache-hit != 'true' + - name: Test Gui + if: steps.cache-gui-fe-build.outputs.cache-hit != 'true' run: npm test - name: Code coverage - if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-fe-build.outputs.cache-hit != 'true' + if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name uses: artiomtr/jest-coverage-report-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -128,6 +129,7 @@ jobs: echo "HASH=$(cat hash.txt)" >> $GITHUB_OUTPUT rm hash.txt shell: bash + - name: Restore cached core frontend build id: cache-gui-core-fe-build uses: actions/cache@v4 @@ -157,7 +159,7 @@ jobs: run: npm test - name: Code coverage - if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-core-fe-build.outputs.cache-hit != 'true' + if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-core-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name uses: artiomtr/jest-coverage-report-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} From c3f19cbc6e0567266a33d36046e5c6548456a589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Lef=C3=A9v=C3=A8re-Laoide?= Date: Mon, 21 Oct 2024 21:02:44 +0200 Subject: [PATCH 2/2] execute if same repo --- .github/workflows/frontend.yml | 4 ++-- .github/workflows/overall-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index bdcad95976..acbb1094b6 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -71,7 +71,7 @@ jobs: run: npm test - name: Code coverage - if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name + if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name uses: artiomtr/jest-coverage-report-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -159,7 +159,7 @@ jobs: run: npm test - name: Code coverage - if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-core-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name + if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-core-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name uses: artiomtr/jest-coverage-report-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/overall-tests.yml b/.github/workflows/overall-tests.yml index 571392fe95..ccf20c23cb 100644 --- a/.github/workflows/overall-tests.yml +++ b/.github/workflows/overall-tests.yml @@ -20,7 +20,7 @@ jobs: coverage: timeout-minutes: 50 runs-on: ubuntu-latest - if: ${{ github.event_name == 'pull_request' }} + if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name steps: - uses: actions/checkout@v4