Skip to content

Commit ae276d0

Browse files
author
rahul-infra
committed
fix: updated versions-preview workflow making it edit the existing release preview
1 parent 6a2736a commit ae276d0

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

.github/workflows/version-preview.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,30 @@ jobs:
8989
body = '## Release Preview\n\nNo new release will be created from this PR.\n\nThis PR does not contain conventional commits that trigger a release.';
9090
}
9191
92-
github.rest.issues.createComment({
93-
issue_number: context.issue.number,
92+
// Find existing comment
93+
const comments = await github.rest.issues.listComments({
9494
owner: context.repo.owner,
9595
repo: context.repo.repo,
96-
body: body
96+
issue_number: context.issue.number
9797
});
98+
99+
const botComment = comments.data.find(comment =>
100+
comment.user.type === 'Bot' && comment.body.includes('## Release Preview')
101+
);
102+
103+
// Update existing or create new
104+
if (botComment) {
105+
await github.rest.issues.updateComment({
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
comment_id: botComment.id,
109+
body: body
110+
});
111+
} else {
112+
await github.rest.issues.createComment({
113+
owner: context.repo.owner,
114+
repo: context.repo.repo,
115+
issue_number: context.issue.number,
116+
body: body
117+
});
118+
}

0 commit comments

Comments
 (0)