Update PR-Demo-cleanup.yml

This commit is contained in:
Ludy87 2025-06-29 22:45:41 +02:00
parent 74aec1a72d
commit cacc0d8994
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -75,20 +75,22 @@ jobs:
issue_number: prNumber issue_number: prNumber
}); });
const deploymentComment = comments.data.find(c => const deploymentComments = comments.data.filter(c =>
c.body?.includes("## 🚀 PR Test Deployment") && c.body?.includes("## 🚀 PR Test Deployment") &&
c.user?.type === "Bot" c.user?.type === "Bot"
); );
if (deploymentComment) { if (deploymentComments.length > 0) {
await github.rest.issues.deleteComment({ for (const comment of deploymentComments) {
owner, await github.rest.issues.deleteComment({
repo, owner,
comment_id: deploymentComment.id repo,
}); comment_id: comment.id
console.log(`Deleted deployment comment (ID: ${deploymentComment.id})`); });
console.log(`Deleted deployment comment (ID: ${comment.id})`);
}
} else { } else {
console.log("No matching deployment comment found."); console.log("No matching deployment comments found.");
} }
core.setOutput('present', hasLabel || deploymentComment ? 'true' : 'false'); core.setOutput('present', hasLabel || deploymentComment ? 'true' : 'false');