Skip to content

Commit 83f8714

Browse files
authored
fix: cleanup cf worker (#1067)
1 parent 3ed2aca commit 83f8714

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.github/workflows/cloudflare-cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
2525
echo "API Response: $RESPONSE"
2626
27-
if echo "$RESPONSE" | grep -q '"success":true'; then
27+
if echo "$RESPONSE" | jq -e '.success == true' > /dev/null 2>&1; then
2828
echo "Successfully deleted $WORKER_NAME"
2929
echo "status=success" >> $GITHUB_OUTPUT
3030
else

.github/workflows/cloudflare-preview.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Cloudflare Workers Preview
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened]
6+
workflow_dispatch:
67

78
concurrency:
89
group: cloudflare-preview-${{ github.event.pull_request.number }}
@@ -66,27 +67,27 @@ jobs:
6667
script: |
6768
const previewUrl = '${{ steps.deployment-url.outputs.url }}';
6869
const prNumber = context.issue.number;
69-
70+
7071
// Find existing comment
7172
const comments = await github.rest.issues.listComments({
7273
owner: context.repo.owner,
7374
repo: context.repo.repo,
7475
issue_number: prNumber,
7576
});
76-
77-
const botComment = comments.data.find(comment =>
78-
comment.user.type === 'Bot' &&
77+
78+
const botComment = comments.data.find(comment =>
79+
comment.user.type === 'Bot' &&
7980
comment.body.includes('Cloudflare Workers Preview')
8081
);
81-
82+
8283
const commentBody = `## 🚀 Cloudflare Workers Preview
83-
84+
8485
Your preview is ready!
85-
86+
8687
**Preview URL:** ${previewUrl}
87-
88+
8889
<sub>Built with commit ${context.sha}</sub>`;
89-
90+
9091
if (botComment) {
9192
// Update existing comment
9293
await github.rest.issues.updateComment({

0 commit comments

Comments
 (0)