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