Skip to content

[docs-infra] Migrate deploy-succeeded to event-triggered function - #23634

Merged
brijeshb42 merged 3 commits into
mui:masterfrom
brijeshb42:netlify-migrate-deploy-event-function
Sep 18, 2026
Merged

brijeshb42 merged 3 commits into
mui:masterfrom
brijeshb42:netlify-migrate-deploy-event-function

Conversation

@brijeshb42

@brijeshb42 brijeshb42 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Migrates netlify/functions/deploy-succeeded.js to Netlify's event-triggered functions API (netlify/functions/on-deploy.mts). Netlify verifies these invocations natively (JWS), so no custom auth needed.

Old review_url/deploy_ssl_url fields are gone from the new payload. PR number and preview URL are now parsed from deploy.permalinkUrl (deploy-preview-<n>--<site> hostname).

Verified live on this PR: CircleCI's e2e-website pipeline gets triggered correctly on deploy preview success.

Related

Same migration applied across other public repos with this webhook:

Netlify's legacy webhook payload for this function (review_url,
deploy_ssl_url) is superseded by the typed event-triggered function
API. The new handler uses the documented Deploy event shape and
Netlify's native JWS verification of event invocations, removing the
need for any custom auth check on our end.

review_url is gone from the new payload, so the PR number is now
parsed from deploy.branch instead.
@brijeshb42 brijeshb42 added type: regression A bug, but worse, it used to behave as expected. scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). labels Sep 17, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23634--material-ui-x.netlify.app/
QR code for https://deploy-preview-23634--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

The initial migration assumed deploy.branch was formatted as
<PR_NUMBER>/head, mirroring the removed review_url field. A live
invocation on this PR showed branch is just the head branch name
(no PR number in it), so the function threw and never called
CircleCI.

Deploy Preview URLs are hostnamed deploy-preview-<n>--<site>, per
Netlify's docs, so parse the PR number from deploy.sslUrl instead.

Also convert on-deploy.mjs to on-deploy.mts, typed against
@netlify/types, now added as a devDependency.
@brijeshb42
brijeshb42 requested a review from a team September 17, 2026 17:33
@brijeshb42
brijeshb42 marked this pull request as ready for review September 17, 2026 17:33
sslUrl mirrors the classic API's ssl_url: the site's shared
production domain, identical on every deploy regardless of
context. A live invocation confirmed this — it returned the
production URL even for a deploy-preview deploy, so the PR-number
regex never matched.

permalinkUrl is per-deploy (classic API's deploy_ssl_url
equivalent) and carries the deploy-preview-<n> hostname the PR
number is parsed from.
@brijeshb42
brijeshb42 force-pushed the netlify-migrate-deploy-event-function branch from 4f31fd2 to c95082f Compare September 17, 2026 17:36
@brijeshb42 brijeshb42 changed the title Migrate deploy-succeeded to event-triggered function [docs-infra] Migrate deploy-succeeded to event-triggered function Sep 17, 2026
@brijeshb42
brijeshb42 merged commit 93185f9 into mui:master Sep 18, 2026
27 checks passed
brijeshb42 added a commit to brijeshb42/base-ui that referenced this pull request Sep 18, 2026
Netlify's legacy webhook payload for this function (review_url,
deploy_ssl_url) is superseded by the typed event-triggered function
API. The new handler uses the documented Deploy event shape and
Netlify's native JWS verification of event invocations, removing the
need for any custom auth check on our end.

review_url is gone from the new payload; sslUrl is the site's shared
production domain (not deploy-specific), so the PR number and preview
URL are now parsed from permalinkUrl instead, which is per-deploy and
hostnamed deploy-preview-<n>--<site> for PR previews.

Verified against mui/mui-x (mui/mui-x#23634),
where this exact migration was tested live and confirmed to trigger
the e2e-website CircleCI pipeline correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants