Skip to content

Commit 3703b14

Browse files
authored
ci: tests workflow comment test results and fix upload results when tests fails (#35)
1 parent f47b916 commit 3703b14

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
contents: read
1111
actions: write
1212
checks: write
13+
pull-requests: write
1314

1415
jobs:
1516
lint-test:
@@ -71,12 +72,27 @@ jobs:
7172
path: 'reports/test-results.json'
7273

7374
- uses: dorny/test-reporter@v2
75+
if: always()
7476
with:
7577
artifact: test-results
7678
name: Mocha Tests
7779
path: 'test-results.json'
7880
reporter: mocha-json
7981

82+
comment-pr:
83+
name: Comment on PR
84+
needs: mocha-test
85+
if: ${{ (success() || failure()) && github.event.pull_request.head.repo.full_name == github.repository}}
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Comment on PR
89+
uses: marocchino/sticky-pull-request-comment@v2.9.4
90+
with:
91+
GITHUB_TOKEN: ${{ github.token }}
92+
header: test-results
93+
message: |
94+
**Test Results:** [Open Results!](https://github.com/hasadna/open-bus-backend/actions/runs/${{ github.run_id }}#user-content-r0)
95+
8096
coverage-test:
8197
name: Test Whit Coverage
8298
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)