Skip to content

fix: Use correct commit SHA in Netlify deployment workflow#4462

Merged
ppawlowski merged 1 commit intomainfrom
fix/netlify-deployment-workflow-commit-sha
Jan 27, 2026
Merged

fix: Use correct commit SHA in Netlify deployment workflow#4462
ppawlowski merged 1 commit intomainfrom
fix/netlify-deployment-workflow-commit-sha

Conversation

@dimitrieh
Copy link
Contributor

Description

Fixes a critical bug in the Netlify deployment sync workflow introduced in #4459.

Problem

The workflow was creating GitHub Deployment objects for the wrong commits. When a PR received a Netlify preview deployment, the workflow would create a deployment for the main branch commit instead of the PR's commit SHA.

Root Cause

Line 27 used context.sha (the workflow run's SHA, always main for status events) instead of github.event.sha (the actual commit that received the status update).

Impact

GitHub showed "No deployments" on PRs despite successful Netlify previews, making the feature completely ineffective.

Fix

Changed ref: context.sha to ref: '${{ github.event.sha }}' so deployments are attached to the correct commits and appear on their respective PRs.

Evidence of Bug

Related Issue(s)

Fixes the bug introduced in #4459. Related to the question raised in #4461.

Checklist

  • I have read the contribution guidelines
  • I have considered the performance impact of these changes
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
  • For blog PRs, an Art Request has been created (instructions)

The workflow was creating GitHub Deployment objects for the wrong
commits. When a PR received a Netlify preview deployment, the workflow
would create a deployment for the main branch commit instead of the
PR's commit.

This happened because the workflow used context.sha (the workflow run's
SHA, which is always main for status events) instead of github.event.sha
(the commit that received the status update).

Result: GitHub showed "No deployments" on PRs despite successful Netlify
previews, making the feature ineffective.

This fix ensures deployments are attached to the correct commits and
appear on their respective PRs.
@dimitrieh
Copy link
Contributor Author

Small fix, see #4461 (comment)

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit 2dfd26d
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/6977aa27041346000848c690
😎 Deploy Preview https://deploy-preview-4462--flowforge-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 82 (🟢 up 27 from production)
Accessibility: 80 (no change from production)
Best Practices: 100 (🟢 up 8 from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@ppawlowski
Copy link
Contributor

Just to understand better, once this fix is applied, we will have 3 places within the same PR that can be used to see the Netlify preview:

  1. Netlify comment
  2. PR checks list
  3. Environment deployment button

Isn't this introducing more confusion than it should?

@dimitrieh
Copy link
Contributor Author

@ppawlowski it would essentially more explicitly surface the same deploy url in the PR. Github constantly surfaces this piece of conflicting UI at the moment.

CleanShot 2026-01-27 at 09 17 03@2x

I'd say let's try it out. If we do not like it we can always remove it.

@ppawlowski ppawlowski merged commit 24db232 into main Jan 27, 2026
7 checks passed
@ppawlowski ppawlowski deleted the fix/netlify-deployment-workflow-commit-sha branch January 27, 2026 10:08
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