|
58 | 58 | env: |
59 | 59 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
60 | 60 |
|
61 | | - - name: Wait for Codecov status |
62 | | - uses: actions/github-script@v7 |
63 | | - id: codecov_check |
64 | | - with: |
65 | | - script: | |
66 | | - const owner = context.repo.owner; |
67 | | - const repo = context.repo.repo; |
68 | | - const ref = context.sha; |
69 | | -
|
70 | | - async function wait(ms) { |
71 | | - return new Promise(resolve => setTimeout(resolve, ms)); |
72 | | - } |
73 | | -
|
74 | | - for (let i = 0; i < 20; i++) { |
75 | | - const { data } = await github.repos.getCombinedStatusForRef({ |
76 | | - owner, |
77 | | - repo, |
78 | | - ref, |
79 | | - }); |
80 | | -
|
81 | | - const codecov = data.statuses.find( |
82 | | - s => s.context === "codecov/patch" |
83 | | - ); |
84 | | -
|
85 | | - if (codecov) { |
86 | | - core.setOutput("state", codecov.state); |
87 | | - return; |
88 | | - } |
89 | | -
|
90 | | - await wait(10000); // ждём 10 сек |
91 | | - } |
92 | | -
|
93 | | - core.setOutput("state", "not_found"); |
94 | | -
|
95 | | - - name: Matrix notify on bad patch coverage |
96 | | - if: steps.codecov_check.outputs.state == 'failure' |
97 | | - uses: Glomberg/matrix-messenger-action@master |
98 | | - with: |
99 | | - server: ${{ secrets.MATRIX_SERVER }} |
100 | | - to: ${{ secrets.MATRIX_EXTERNSION_ROOM }} |
101 | | - token: ${{ secrets.MATRIX_USER_TOKEN }} |
102 | | - message: | |
103 | | - ⚠ Patch coverage below target (70%)! |
104 | | - Repository: ${{ github.repository }} |
105 | | - Commit: ${{ github.sha }} |
106 | | - Actor: ${{ github.actor }} |
107 | | - Please increase test coverage. |
108 | | -
|
109 | 61 | - name: Matrix notify on failure |
110 | 62 | if: failure() |
111 | 63 | uses: Glomberg/matrix-messenger-action@master |
|
0 commit comments