Skip to content

Commit 957bd6c

Browse files
committed
making sure that only PR will run
1 parent 5095eae commit 957bd6c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/actions/test-coverage/action.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ runs:
1616
uses: ./.github/actions/prepare-node-deps
1717

1818
- name: ci/get-last-run-id
19+
if: github.event_name == 'pull_request'
20+
id: get-last-run-id
1921
uses: actions/cache/restore@0c907a75c2c80ebcb7f088228285e798b750cf8f
2022
continue-on-error: true
2123
with:
@@ -24,14 +26,21 @@ runs:
2426
restore-keys: |
2527
last-run-id-
2628
29+
- name: Set PR condition
30+
if: github.event_name == 'pull_request' && steps.get-last-run-id.outcome == 'success'
31+
shell: bash
32+
run: echo "IS_PR_WITH_CACHE=true" >> $GITHUB_ENV
33+
2734
- name: ci/put-last-run-id-into-env
35+
if: env.IS_PR_WITH_CACHE == 'true'
2836
shell: bash
2937
run: |
3038
echo "::group::put-last-run-id-into-env"
3139
echo "LAST_RUN_ID=$(cat run-id.txt)" >> $GITHUB_ENV
3240
echo "::endgroup::"
3341
3442
- name: ci/download-main-coverage
43+
if: env.IS_PR_WITH_CACHE == 'true'
3544
uses: actions/download-artifact@v4
3645
with:
3746
name: test-coverage-result-${{ env.LAST_RUN_ID }}
@@ -40,20 +49,22 @@ runs:
4049
run-id: ${{ env.LAST_RUN_ID }}
4150

4251
- name: ci/read-coverage
52+
if: env.IS_PR_WITH_CACHE == 'true'
4353
shell: bash
4454
run: |
4555
echo "::group::read-coverage"
4656
./scripts/read-coverage.sh ./main-coverage/coverage-summary.json
4757
echo "::endgroup::"
4858
49-
- name: ci/run-tests
59+
- name: ci/run-tests-with-coverage
5060
shell: bash
5161
run: |
5262
echo "::group::run-tests"
5363
npm run test:coverage
5464
echo "::endgroup::"
5565
5666
- name: ci/compare-coverage
67+
if: env.IS_PR_WITH_CACHE == 'true'
5768
shell: bash
5869
run: |
5970
echo "::group::compare-coverage"

0 commit comments

Comments
 (0)