Skip to content

Commit 21cfd8b

Browse files
committed
add comment about test status
1 parent 8dab486 commit 21cfd8b

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/test.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
87
workflow_dispatch:
98

109
jobs:
1110
test:
1211
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
14+
1315
steps:
1416
- name: Checkout code
1517
uses: actions/checkout@v5
@@ -36,3 +38,24 @@ jobs:
3638
DB_URL: file:database/local.db
3739
DB_VISITS_URL: file:database/visits.db
3840
run: pnpm db:update
41+
42+
- name: Find Comment
43+
if: ${{ always() && github.event_name == 'pull_request' }}
44+
uses: peter-evans/find-comment@v3
45+
id: fc
46+
with:
47+
issue-number: ${{ github.event.pull_request.number }}
48+
comment-author: 'github-actions[bot]'
49+
body-includes: Test Workflow Status
50+
51+
- name: Create or update comment
52+
if: ${{ always() && github.event_name == 'pull_request' }}
53+
uses: peter-evans/create-or-update-comment@v5
54+
with:
55+
comment-id: ${{ steps.fc.outputs.comment-id }}
56+
issue-number: ${{ github.event.pull_request.number }}
57+
edit-mode: replace
58+
body: |
59+
<!-- Test Workflow Status -->
60+
${{ job.status == 'success' && 'Tests have passed ✅'
61+
|| '⚠️ Automated testing for this pull request has failed. Please examine the run logs to identify the root cause of the error. Additional information regarding these tests can be found in the [contribution guidelines](https://github.com/ScriptRaccoon/CatDat/blob/main/CONTRIBUTING.md).' }}

0 commit comments

Comments
 (0)