Skip to content

Commit 8183f1b

Browse files
committed
fix: update staging deploy PR comment instead of creating duplicates
Include commit SHA in the comment body and reuse the existing comment on subsequent deploys instead of flooding the PR with new ones.
1 parent 28b8f38 commit 8183f1b

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,26 @@ jobs:
4444
uses: actions/github-script@v7
4545
with:
4646
script: |
47-
github.rest.issues.createComment({
47+
const marker = '<!-- staging-deploy -->';
48+
const body = `${marker}\n✅ Staging deployment successful!\n\nPreview: https://vp-setup-staging.void.app/\nCommit: ${context.sha}`;
49+
const { data: comments } = await github.rest.issues.listComments({
4850
owner: context.repo.owner,
4951
repo: context.repo.repo,
5052
issue_number: context.issue.number,
51-
body: '✅ Staging deployment successful!\n\nPreview: https://vp-setup-staging.void.app/'
52-
})
53+
});
54+
const existing = comments.find(c => c.body.includes(marker));
55+
if (existing) {
56+
await github.rest.issues.updateComment({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
comment_id: existing.id,
60+
body,
61+
});
62+
} else {
63+
await github.rest.issues.createComment({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
issue_number: context.issue.number,
67+
body,
68+
});
69+
}

0 commit comments

Comments
 (0)