File tree Expand file tree Collapse file tree 1 file changed +32
-5
lines changed
Expand file tree Collapse file tree 1 file changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -233,11 +233,38 @@ jobs:
233233 }).join("\n")}
234234 `
235235
236- await github.rest.issues.deleteComment({
237- owner: context.repo.owner,
238- repo: 'core',
239- comment_id: ${{ needs.init.outputs.comment-id }}
240- })
236+ if (selectedSuite === "-") {
237+ // delete the previous ran results
238+ try {
239+ const { data: comments } = await github.rest.issues.listComments({
240+ issue_number: context.payload.inputs.prNumber,
241+ owner: context.repo.owner,
242+ repo: 'core'
243+ })
244+ const workflowComments = comments.filter(comment =>
245+ comment.body.includes('Ran ecosystem CI:') || comment.body.includes('Triggered ecosystem CI:')
246+ )
247+ for (const comment of workflowComments) {
248+ await github.rest.issues.deleteComment({
249+ owner: context.repo.owner,
250+ repo: 'core',
251+ comment_id: comment.id
252+ });
253+ console.log(`Deleted previous comment: ${comment.id}`);
254+ }
255+ } catch (error) {
256+ console.log('Error when trying to delete previous comments:', error);
257+ }
258+ }
259+
260+ try {
261+ await github.rest.issues.deleteComment({
262+ owner: context.repo.owner,
263+ repo: 'core',
264+ comment_id: ${{ needs.init.outputs.comment-id }}
265+ })
266+ } catch (error) {
267+ }
241268
242269 await github.rest.issues.createComment({
243270 issue_number: context.payload.inputs.prNumber,
You can’t perform that action at this time.
0 commit comments