Skip to content

Conversation

@pranav-new-relic
Copy link
Member

@pranav-new-relic pranav-new-relic commented Nov 7, 2025

✨ Summary

Enhances the Netlify deployment preview workflow with deployment tracking, and comprehensive error handling.

Why do (I think) we need this?

The current workflow that is triggered upon commenting netlify build on the PR only "triggers" a build on Netlify, but does not report the status of the build back - implying that the CI check triggered by the netlify build ends at triggering the build, and succeeds all the time. This leads to an incomplete check, and the onus is on the reviewers of the PR to go to Netlify to find the status of the build, as a preview link is returned by the current workflow if it is successful; else, it returns nothing.

While this is the current process, this leaves a lot of room for erroenous considerations to be made; it is highly probable that

  • a reviewer gets the PR accidentally merged if they miss checking Netlify to find the latest build status on the PR, or
  • a reviewer goes by an optimal scenario in which the build worked many commits ago, after which a bunch of trivial commits were added, causing a notion that a re-check is not needed (though it could be likely that the smallest of discrepancies in the latest commits could be leading to a build failure - the example with the 31st June case :))

and all of this did occur multiple times in the past; neither does the CI check fail (it succeeds all the time) so we do not obstruct a merge, nor do we notify the maintainers in the PR's comments that the build is screwed - leading to the check getting ignored at times, causing a major debacle later on in the daily release PRs.

Obviously, all of this hassle is now seen because we no longer use Netlify's Deploy Preview feature (which would handle the entire process of building on a commit, and notifying maintainers) - and when we do not do so, the only way to get the status of a build, is to:

  • run a build in the CI's environment, i.e. instead of using Netlify's runtime, build Netlify here in the GitHub CI's runners (modify the workflow to do so), and then, run the exact same build directly in the runner
  • continue using the approach in the existing workflow (to trigger a build on Netlify, via the Netlify API), and then, keep polling to map ongoing builds associated with the current branch to the commit using which the build was triggered - and continue to keep track of the build's status to keep reporting the latest on the build to the PR (and affect the status of the CI check accordingly).

I did try (1) with #22133, only to realise that GitHub CI's runners are too lightweight to run a heavy job like scaffolding Netlify and dependencies via npm, and then run a build - most builds kept running for over 1hr 50 minutes and eventually timed out; implying, this method is infeasible - so (2) seemed to be the only route. This is the approach proposed by the workflow modified in this PR.

In simpler words, the workflow's trigger remains the same - a netlify build comment, and the immediate step after this remains the same too - triggering a build on Netlify using the Netlify API. Post this, a bunch of additional steps have been added.

  • Netlify's API is polled to find out all ongoing builds associated with the current branch, and these are filtered to find the build associated with the latest commit on the branch (after which the netlify build comment was made to trigger the build) - after which a build is identified, and this build is monitored by the workflow.
  • As the build is kept track of, updates are posted as PR comments. Firstly, after the build is found, details of the deployment on Netlify (URL, etc) are posted to the PR comment; and similar updates are made to the same comment when it is in progress. Based on the status of the build towards the end - if the build is successful, the CI check succeeds and a comment is added confirming the success status; but if it fails, the CI check fails, and a similar comment is added in vibrant red to let the maintainer know that the PR should not be merged.
    A few other changes do exist too, e.g. checking for any existing builds on the branch to prevent "concurrent" builds running (to save resources), using branch based filtering if a commit-based build is not found, checking if the build times out and adding comments accordingly, checking for credential expiry, and a bunch of edge cases I could think of.

The success comment looks like this.
The failure comment looks like this.
Upon commenting netlify build , if it is found that there is a build associated with this branch that is already in progress, this is the comment shown.

Netlify Workflow Improvements

Deployment Discovery & Monitoring

  • Commit-based deployment matching with branch-based fallback
  • 45-second initial wait, then 10 polling attempts with 15s intervals
  • Status monitoring polls every 90s for up to 30 minutes
  • Real-time PR comment updates with IST timestamps

Outcome Handling

  • Success: Posts preview URL, a link to the deployment on Netlify and other details
  • Failure: Posts critical DO-NOT-MERGE warning with brief error details and a link to the failing deployment on Netlify
  • Timeout: Provides manual check instructions

Pre-deployment Validation

  • Netlify API token validation before triggering builds
  • Concurrent deployment detection prevents conflicts
  • Posts actionable error comments for token expiration or ongoing builds

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

Hi @pranav-new-relic 👋

Thanks for your pull request! Your PR is in a queue, and a writer will take a look soon. We generally publish small edits within one business day, and larger edits within three days.

Please ensure the propsed changes look good by building it first in your local environment. Refer to this contribution guide to get the site up and running in your local.

If you really require a preview url, reach out to one of the writers and they will generate one for you.

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🚀 Netlify Preview Building!

If the build is successful, the preview for this pull request will be available at the following URL (usually takes 10-20 minutes):

https://np-test-v2--docs-website-netlify.netlify.app

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🚀 Netlify Preview Building!

Build triggered for PR #22137 (commit: 6608308697b6148e056129666d4c30233ceefcb3)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🚨 ⛔ NETLIFY DEPLOYMENT FAILED ⛔ 🚨

DO NOT MERGE THIS PR

The Netlify preview deployment has FAILED. This PR contains changes that break the build process.

🔴 Critical Issue Details:

  • Status: Build Failed
  • Deploy ID: 690e58a053e6f500084e70b6
  • Error Message:
Canceled build

🔗 Netlify Deployment: View Deployment
🔗 GitHub Actions Job: View Job

🛠️ Required Actions:

  1. Review the error message above carefully
  2. Fix the build issues in your branch
  3. Test locally before pushing changes
  4. Trigger a new build with netlify build comment once fixed

⚠️ WARNING TO MAINTAINERS:

This PR has a failing build and should NOT be merged until:

  • ✅ All build errors are resolved
  • ✅ A successful deployment preview is confirmed
  • ✅ The preview site has been manually tested

🔴 MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION 🔴

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🚀 Netlify Preview Building!

Build triggered for PR #22137 (commit: a2f5c11544b5fd6014c5e35293f64544c0a6a716)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🚨 ⛔ NETLIFY DEPLOYMENT FAILED ⛔ 🚨

DO NOT MERGE THIS PR

The Netlify preview deployment has FAILED. This PR contains changes that break the build process.

🔴 Critical Issue Details:

  • Status: Build Failed
  • Deploy ID: 690e5b325521e10008ed5122
  • Error Message:
Failed during stage 'building site': Build script returned non-zero exit code: 2

🔗 Netlify Deployment: View Deployment
🔗 GitHub Actions Job: View Job

🛠️ Required Actions:

  1. Review the error message above carefully
  2. Fix the build issues in your branch
  3. Test locally before pushing changes
  4. Trigger a new build with netlify build comment once fixed

⚠️ WARNING TO MAINTAINERS:

This PR has a failing build and should NOT be merged until:

  • ✅ All build errors are resolved
  • ✅ A successful deployment preview is confirmed
  • ✅ The preview site has been manually tested

🔴 MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION 🔴

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

🚀 Netlify Preview Building!

Build triggered for PR #22137 (commit: e30124a9c465179937d8ae1af5eb83b4f634a288)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

[!NOTE]

Our Vale automated writing feedback tool has suggestions for this PR. You can view these suggestions in the Files changed tab. If you're not a New Relic docs writer, we'll review any comments and you don't need to take any action (though feel free to make edits if you like!).

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

🚀 Netlify Preview Building!

Build triggered for PR #22137 (commit: b13e0f18e79ae7ccfad1983d174c82fd2001826e)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

🚀 Netlify Preview Building!

Build triggered for PR #22137 (commit: b804bdf325984c918e6abd3812410b1243ccaea3)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 00:39:11 IST | Commit: e611b72)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

  • Ongoing Deploy ID: 6925fec860318800082d1978
  • Triggered by Commit: null
  • Monitor Progress: View Deployment

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

🚀 Netlify Preview Building...

(Update logged at: 11/26/2025, 00:41:44 IST | Commit: af94944)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.


⏳ Netlify Deployment In Progress

(Update logged at: 11/26/2025, 00:44:53 IST | Commit: af94944)

  • Status: Deployment found on Netlify.
  • Deploy ID: 6925ff70915a44000848ba35
  • Validation: Branch-based
  • Netlify Build URL: View Deployment
  • GitHub Actions Job: View Job Log
  • Deployment Created: 2025-11-26 00:41:44 IST

⏳ Build is currently in progress. Monitoring status...


✅ Netlify Preview Deploy Successful!

(Update logged at: 11/26/2025, 24:53:57 IST | Commit: af94944)

The preview is ready for review. Please test your changes thoroughly before merging.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 00:42:44 IST | Commit: 37e0d09)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

🚀 Netlify Preview Building...

(Update logged at: 11/26/2025, 01:05:38 IST | Commit: e8fb944)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.


⏳ Netlify Deployment In Progress

(Update logged at: 11/26/2025, 01:08:51 IST | Commit: e8fb944)

  • Status: Deployment found on Netlify.
  • Deploy ID: 6926050a0a9e0100077a4e2c
  • Validation: Branch-based
  • Netlify Build URL: View Deployment
  • GitHub Actions Job: View Job Log
  • Deployment Created: 2025-11-26 01:05:38 IST

⏳ Build is currently in progress. Monitoring status...


✅ Netlify Preview Deploy Successful!

(Update logged at: 11/26/2025, 01:11:54 IST | Commit: e8fb944)

The preview is ready for review. Please test your changes thoroughly before merging.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 01:06:30 IST | Commit: 50a51e8)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

  • Ongoing Deploy ID: 6926050a0a9e0100077a4e2c
  • Triggered by Commit: null
  • Monitor Progress: View Deployment

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 01:09:55 IST | Commit: c901d11)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

🚀 Netlify Preview Building...

(Update logged at: 11/26/2025, 01:15:54 IST | Commit: e5d6296)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.


⏳ Netlify Deployment In Progress

(Update logged at: 11/26/2025, 01:16:57 IST | Commit: e5d6296)

  • Status: Deployment found on Netlify.
  • Deploy ID: 692607728c9f890008494fc5
  • Validation: Commit-based (e5d6296)
  • Netlify Build URL: View Deployment
  • GitHub Actions Job: View Job Log
  • Deployment Created: 2025-11-26 01:15:54 IST

⏳ Build is currently in progress. Monitoring status...


✅ Netlify Preview Deploy Successful!

(Update logged at: 11/26/2025, 01:21:30 IST | Commit: e5d6296)

The preview is ready for review. Please test your changes thoroughly before merging.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 01:17:27 IST | Commit: ecac756)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

⏳ A Netlify Deployment is Already in Progress

(Update logged at: 11/26/2025, 01:18:04 IST | Commit: bffdc3b)

An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.

Once the previous deployment is finished, you can trigger a new build by commenting netlify build on this PR.

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

🚀 Netlify Preview Building...

(Update logged at: 11/26/2025, 01:28:27 IST | Commit: ec0f92e)

⏳ Monitoring deployment status... This usually takes 10-20 minutes.


⏳ Netlify Deployment In Progress

(Update logged at: 11/26/2025, 01:29:15 IST | Commit: ec0f92e)

  • Status: Deployment found on Netlify.
  • Deploy ID: 69260a64bd930c000890f9e7
  • Validation: Commit-based (ec0f92e)
  • Netlify Build URL: View Deployment
  • GitHub Actions Job: View Job Log
  • Deployment Created: 2025-11-26 01:28:28 IST

⏳ Build is currently in progress. Monitoring status...


✅ Netlify Preview Deploy Successful!

(Update logged at: 11/26/2025, 01:33:48 IST | Commit: ec0f92e)

The preview is ready for review. Please test your changes thoroughly before merging.

@pranav-new-relic
Copy link
Member Author

@copilot would you mind generating a comprehensive PR description, encompassing all of the changes covered by this PR? I would like the PR to be comprehensive, but not too detailed - it can be concise, briefly explain things it adds. The description does not need to include a lot of jargon or be too technically complex; it can talk about the problem statement (why is this needed in the first place - the benefits of this), an outline of the approach, the working of it in a logical flow of events for someone to understand, and a similarly structured concise description - ensuring all cases covered by the workflow are explained in brief too.

Copy link

Copilot AI commented Nov 25, 2025

@pranav-new-relic I've opened a new pull request, #22289, to work on those changes. Once the pull request is ready, I'll request review from you.

@pranav-new-relic pranav-new-relic changed the title chore: test PR v2, build break test with 31st June: DO NOT MERGE chore(workflows): enhance netlify build CI workflow to reflect status of builds triggered and furnish build details Nov 26, 2025
@pranav-new-relic pranav-new-relic changed the title chore(workflows): enhance netlify build CI workflow to reflect status of builds triggered and furnish build details chore(workflows): enhance netlify build CI workflow to reflect status of triggered builds and furnish build details Nov 26, 2025
@pranav-new-relic pranav-new-relic marked this pull request as ready for review November 26, 2025 05:48
@pranav-new-relic pranav-new-relic requested a review from a team as a code owner November 26, 2025 05:48

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 8 days ago

To fix this problem, we should explicitly declare the permissions key at the start of the workflow file, just after the name (and before on:). This key should minimally grant contents: read (as required to allow workflows to fetch repo contents) and issues: write (because the workflow uses GitHub Actions and actions/github-script to comment on issues and PRs). Other permissions (such as pull-requests: write) are not strictly necessary unless the workflow edits PRs or labels, which, based on the workflow steps, it does not.

The fix involves adding the following block near the top of .github/workflows/final-manual-deploy-comment.yml:

permissions:
  contents: read
  issues: write

This will scope the automatic GITHUB_TOKEN to the minimal required privileges for all jobs. No other changes are needed.


Suggested changeset 1
.github/workflows/final-manual-deploy-comment.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -1,5 +1,9 @@
 name: Final 'Comment' Netlify Build + Build Reportage (Manual Deploy)
 
+permissions:
+  contents: read
+  issues: write
+
 on:
   issue_comment:
     types: [created]
EOF
@@ -1,5 +1,9 @@
name: Final 'Comment' Netlify Build + Build Reportage (Manual Deploy)

permissions:
contents: read
issues: write

on:
issue_comment:
types: [created]
Copilot is powered by AI and may make mistakes. Always verify output.
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