Skip to content

Commit e238842

Browse files
committed
fix: preview
1 parent 9d16121 commit e238842

2 files changed

Lines changed: 29 additions & 44 deletions

File tree

.github/workflows/cloudflare-preview.yml

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -61,47 +61,31 @@ jobs:
6161
echo "Preview URL: $PREVIEW_URL"
6262
6363
- name: Comment PR with preview link
64-
uses: actions/github-script@v7
64+
uses: actions-cool/maintain-one-comment@v3
6565
with:
66-
github-token: ${{ secrets.GITHUB_TOKEN }}
67-
script: |
68-
const previewUrl = '${{ steps.deployment-url.outputs.url }}';
69-
const prNumber = context.issue.number;
70-
71-
// Find existing comment
72-
const comments = await github.rest.issues.listComments({
73-
owner: context.repo.owner,
74-
repo: context.repo.repo,
75-
issue_number: prNumber,
76-
});
77-
78-
const botComment = comments.data.find(comment =>
79-
comment.user.type === 'Bot' &&
80-
comment.body.includes('Cloudflare Workers Preview')
81-
);
82-
83-
const commentBody = `## 🚀 Cloudflare Workers Preview
84-
85-
Your preview is ready!
86-
87-
**Preview URL:** ${previewUrl}
88-
89-
<sub>Built with commit ${context.sha}</sub>`;
90-
91-
if (botComment) {
92-
// Update existing comment
93-
await github.rest.issues.updateComment({
94-
owner: context.repo.owner,
95-
repo: context.repo.repo,
96-
comment_id: botComment.id,
97-
body: commentBody
98-
});
99-
} else {
100-
// Create new comment
101-
await github.rest.issues.createComment({
102-
owner: context.repo.owner,
103-
repo: context.repo.repo,
104-
issue_number: prNumber,
105-
body: commentBody
106-
});
107-
}
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
body: |
68+
🚀 Cloudflare Workers Preview has been successfully deployed!
69+
70+
**Preview URL:** ${{ steps.deployment-url.outputs.url }}
71+
72+
<sub>Built with commit ${{ github.event.pull_request.head.sha }}</sub>
73+
74+
<!-- Cloudflare Preview Comment -->
75+
body-include: '<!-- Cloudflare Preview Comment -->'
76+
number: ${{ github.event.pull_request.number }}
77+
78+
- name: Deploy failed
79+
if: ${{ failure() }}
80+
uses: actions-cool/maintain-one-comment@v3
81+
with:
82+
token: ${{ secrets.GITHUB_TOKEN }}
83+
body: |
84+
😭 Cloudflare Workers Preview deployment failed.
85+
86+
Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
87+
88+
<!-- Cloudflare Preview Comment -->
89+
body-include: '<!-- Cloudflare Preview Comment -->'
90+
number: ${{ github.event.pull_request.number }}
91+

apps/web/src/components/editor/editor-header/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ async function copy() {
266266
<!-- 文章信息(移动端隐藏) -->
267267
<PostInfo class="hidden md:inline-flex" />
268268

269+
<!-- 编辑器设置按钮 -->
269270
<Popover>
270271
<PopoverTrigger as-child>
271272
<Button variant="outline" size="icon" class="mr-1">
@@ -277,7 +278,7 @@ async function copy() {
277278
</PopoverContent>
278279
</Popover>
279280

280-
<!-- 设置按钮 -->
281+
<!-- 样式面板 -->
281282
<Button
282283
variant="outline"
283284
size="icon"

0 commit comments

Comments
 (0)