Skip to content

Address Benjie's review feedback#56

Draft
magicmark wants to merge 1 commit into
magicmark-patch-6from
fix/benjie-review-feedback
Draft

Address Benjie's review feedback#56
magicmark wants to merge 1 commit into
magicmark-patch-6from
fix/benjie-review-feedback

Conversation

@magicmark

@magicmark magicmark commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Addresses the review comments from benjie on #40:

  1. ref: main on checkout step — makes it explicit we're pulling trusted config from main, not from the PR branch
  2. Commit hash in deploy message — adds (${{ github.event.workflow_run.head_sha }}) for traceability
  3. Extract inline JS — moves the hide-old-comments logic to .github/scripts/hide-old-deploy-comments.mjs (also adds .github/scripts to sparse-checkout so it's available at runtime)
  4. Security: outside bounds zip extraction — documents that actions/download-artifact handles extraction safely
  5. Security: static-only wrangler — documents that wrangler is configured for static asset serving only

All changes verified end-to-end on magicmark/gaps-website-test-1 with both fork and non-fork PRs deploying successfully to Cloudflare Workers.

- Add explicit ref: main to checkout step (prevents config poisoning)
- Include commit hash in wrangler deploy message for traceability
- Extract hide-old-comments logic to .github/scripts/hide-old-deploy-comments.mjs
- Add .github/scripts to sparse-checkout so the extracted script is available
- Add security comments documenting zip-slip safety and static-only wrangler model
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gaps 18c0148 Commit Preview URL

Branch Preview URL
Jun 25 2026, 05:26 AM

@magicmark magicmark marked this pull request as draft June 25, 2026 05:35

@benjie benjie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🙌

// Called from preview-deploy.yml via actions/github-script.

export default async function run({ github, context, prNumber }) {
const { data: comments } = await github.rest.issues.listComments({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per_page defaults to 30, so this will only find the comments to update if in the first 30.


await Promise.all(
comments
.filter((c) => c.body.includes("<!-- deploy-preview -->"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When people reply to GitHub notification emails it often includes a copy of the previous message - if it copies this from the bot's message then their comment will also be hidden.

Suggest you also filter by author.

apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload --preview-alias "pr-${{ steps.pr.outputs.number }}" --message "PR #${{ steps.pr.outputs.number }} preview"
command: versions upload --preview-alias "pr-${{ steps.pr.outputs.number }}" --message "PR #${{ steps.pr.outputs.number }} preview (${{ github.event.workflow_run.head_sha }})"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does wranger versions upload do a pure upload, or might it read any configuration/run any scripts/be influenced by any content from within _site?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants