Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/cloudflare-web-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ name: Cloudflare Worker Preview Deploy

on:
pull_request:
paths:
- 'src/**'
- 'index.html'
- 'package.json'
- 'package-lock.json'
- 'vite.config.ts'
- 'tsconfig.json'
- '.github/workflows/cloudflare-web-preview.yml'
- '.github/actions/setup/**'

concurrency:
group: cloudflare-worker-preview-${{ github.event.pull_request.number }}
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/require-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,38 @@ jobs:
fi

- name: Manage changeset comment
if: steps.labels.outputs.skip == 'false'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
env:
SKIP: ${{ steps.labels.outputs.skip }}
CHANGESET_FOUND: ${{ steps.check.outputs.found }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const marker = '<!-- require-changeset -->';
const skip = process.env.SKIP === 'true';
const found = process.env.CHANGESET_FOUND === 'true';
const { owner, repo } = context.repo;
const issue_number = context.issue.number;

// Always delete the old comment first so the new one appears fresh after each commit
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number,
});
const existing = comments.find(
(c) => c.user.type === 'Bot' && c.body.includes(marker),
);
if (existing) {
await github.rest.issues.deleteComment({
owner, repo, comment_id: existing.id,
});

if (skip || found) {
// Clean up the warning comment — changeset added or PR marked internal
if (existing) {
await github.rest.issues.deleteComment({
owner, repo, comment_id: existing.id,
});
}
return;
}

if (!found) {
const body = `${marker}
### ⚠️ Missing changeset
const body = `${marker}
## ⚠️ Missing changeset

This pull request does not include a changeset. Please add one before requesting review so the change is properly documented and included in the release notes.

Expand All @@ -99,6 +103,10 @@ jobs:

> If this PR is internal/maintenance with no user-facing impact, a maintainer can add the \`internal\` label to skip this check.`;

await github.rest.issues.createComment({ owner, repo, issue_number, body });
core.setFailed('No changeset found. Add a changeset file or apply the "internal" label to skip.');
if (existing) {
await github.rest.issues.deleteComment({
owner, repo, comment_id: existing.id,
});
}
await github.rest.issues.createComment({ owner, repo, issue_number, body });
core.setFailed('No changeset found. Add a changeset file or apply the "internal" label to skip.');
Loading