mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
Update PR-Demo-cleanup.yml
This commit is contained in:
parent
299d52c517
commit
c0d7b89fe0
15
.github/workflows/PR-Demo-cleanup.yml
vendored
15
.github/workflows/PR-Demo-cleanup.yml
vendored
@ -47,7 +47,7 @@ jobs:
|
|||||||
const owner = context.repo.owner;
|
const owner = context.repo.owner;
|
||||||
const repo = context.repo.repo;
|
const repo = context.repo.repo;
|
||||||
|
|
||||||
// Hole alle Labels auf dem PR
|
// Get all labels on the PR
|
||||||
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
|
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@ -68,14 +68,13 @@ jobs:
|
|||||||
console.log("Label 'pr-deployed' not found. Nothing to do.");
|
console.log("Label 'pr-deployed' not found. Nothing to do.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find existing comment
|
// Find existing bot comments about the deployment
|
||||||
const comments = await github.rest.issues.listComments({
|
const { data: comments } = await github.rest.issues.listComments({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
issue_number: prNumber
|
issue_number: prNumber
|
||||||
});
|
});
|
||||||
|
const deploymentComments = comments.filter(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"
|
||||||
);
|
);
|
||||||
@ -92,7 +91,11 @@ jobs:
|
|||||||
} else {
|
} else {
|
||||||
console.log("No matching deployment comments found.");
|
console.log("No matching deployment comments found.");
|
||||||
}
|
}
|
||||||
core.setOutput('present', hasLabel || deploymentComment ? 'true' : 'false');
|
|
||||||
|
// Set flag if either label or comment was present
|
||||||
|
const hasDeploymentComment = deploymentComments.length > 0;
|
||||||
|
core.setOutput('present', (hasLabel || hasDeploymentComment) ? 'true' : 'false');
|
||||||
|
|
||||||
|
|
||||||
- name: Set up SSH
|
- name: Set up SSH
|
||||||
if: steps.remove-label-comment.outputs.present == 'true'
|
if: steps.remove-label-comment.outputs.present == 'true'
|
||||||
|
Loading…
Reference in New Issue
Block a user