Add GitHub Deployments sync for Netlify previews#4459
Conversation
Netlify does not natively create GitHub Deployment objects when deploying preview builds. This workflow listens for Netlify status events and creates corresponding GitHub Deployment objects, making preview deployments visible in GitHub's native deployment UI. The workflow triggers on Netlify preview deployment success and creates a transient Preview environment with a link to the Netlify preview URL.
✅ Deploy Preview for flowforge-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This PR doesn't yet show a deployment status as GitHub only runs workflows that exist on the main branch, so this workflow won't activate until after it's merged. This is a security measure to prevent malicious code in PRs from executing. Once merged, all future PRs will automatically get deployment objects when Netlify deploys them. To test it, just create a new PR after merging this one. |
|
@hardillb can you give this a review? Created this as #4431 is an example where the deployment comment from Netlify is not creating a linear story in the PR. I was confused if it actually deployed the latest changes or not. Also, the having the github deployment status it has not been deployed is not really productive 🙃. This PR should resolve that once merged to master
|
|
@ppawlowski might want to look at this to go with the pre-staging stuff we were talking about in the dev team meeting |


Description
This PR adds a GitHub Actions workflow that syncs Netlify preview deployments to GitHub's native Deployments API.
The Problem
Netlify does not natively create GitHub Deployment objects when deploying preview builds. While Netlify successfully posts PR comments and status checks, it does not use GitHub's Deployments API. This has been a long-standing limitation that Netlify has consistently declined to implement despite user requests since 2020.
As a result, GitHub's deployment UI shows "This branch has not been deployed" with "No deployments" on pull requests.
How This Works
The workflow is event-driven and automatic:
statusevent → triggers this workflowNo polling, no periodic checks, no wasted Actions minutes. The workflow only runs when Netlify posts a successful preview deployment status.
No Conflicts
This workflow is safe and isolated:
statusevent trigger, doesn't affect other workflowsMinimal Permissions
The workflow has restricted permissions:
deployments: write- Only creates deployment metadatastatuses: read- Only reads Netlify status checkscontents: read- Only reads repository infoCannot modify code, push commits, or access secrets.
Related Issue(s)
Resolves the issue where GitHub's deployment UI shows "No deployments" despite Netlify successfully deploying preview builds.
Checklist