16
16
uses : ./.github/actions/prepare-node-deps
17
17
18
18
- name : ci/get-last-run-id
19
+ if : github.event_name == 'pull_request'
20
+ id : get-last-run-id
19
21
uses : actions/cache/restore@0c907a75c2c80ebcb7f088228285e798b750cf8f
20
22
continue-on-error : true
21
23
with :
@@ -24,14 +26,21 @@ runs:
24
26
restore-keys : |
25
27
last-run-id-
26
28
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
+
27
34
- name : ci/put-last-run-id-into-env
35
+ if : env.IS_PR_WITH_CACHE == 'true'
28
36
shell : bash
29
37
run : |
30
38
echo "::group::put-last-run-id-into-env"
31
39
echo "LAST_RUN_ID=$(cat run-id.txt)" >> $GITHUB_ENV
32
40
echo "::endgroup::"
33
41
34
42
- name : ci/download-main-coverage
43
+ if : env.IS_PR_WITH_CACHE == 'true'
35
44
uses : actions/download-artifact@v4
36
45
with :
37
46
name : test-coverage-result-${{ env.LAST_RUN_ID }}
@@ -40,20 +49,22 @@ runs:
40
49
run-id : ${{ env.LAST_RUN_ID }}
41
50
42
51
- name : ci/read-coverage
52
+ if : env.IS_PR_WITH_CACHE == 'true'
43
53
shell : bash
44
54
run : |
45
55
echo "::group::read-coverage"
46
56
./scripts/read-coverage.sh ./main-coverage/coverage-summary.json
47
57
echo "::endgroup::"
48
58
49
- - name : ci/run-tests
59
+ - name : ci/run-tests-with-coverage
50
60
shell : bash
51
61
run : |
52
62
echo "::group::run-tests"
53
63
npm run test:coverage
54
64
echo "::endgroup::"
55
65
56
66
- name : ci/compare-coverage
67
+ if : env.IS_PR_WITH_CACHE == 'true'
57
68
shell : bash
58
69
run : |
59
70
echo "::group::compare-coverage"
0 commit comments