From c4089ff85dcb0bd2d147ac105d1f791e7e1d5a7c Mon Sep 17 00:00:00 2001
From: Pranav Nandula <127438038+pranav-new-relic@users.noreply.github.com>
Date: Fri, 7 Nov 2025 15:44:32 +0530
Subject: [PATCH 01/43] chore: build break test with 31st June
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index e48c12e63cc..f1740a9aff5 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-30'
+releaseDate: '2025-06-31'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From 325c20783766da718ab890a9279d7925a2fa63b2 Mon Sep 17 00:00:00 2001
From: Pranav Nandula <127438038+pranav-new-relic@users.noreply.github.com>
Date: Fri, 7 Nov 2025 17:24:22 +0530
Subject: [PATCH 02/43] chore: AI experiment to revamp netlify build comment
workflow
---
.../workflows/final-manual-deploy-comment.yml | 230 +++++++++++-------
1 file changed, 141 insertions(+), 89 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 1b7b7dfdfa8..db0b011e06c 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -1,96 +1,86 @@
-name: Final Netlify build manual deploy comment #temp name
+name: Final Netlify build manual deploy comment
on:
issue_comment:
types: [created]
+ # This is the new trigger that allows testing from a PR branch
+ pull_request:
+ types: [opened, synchronize]
jobs:
deploy-preview:
- # when a contributor comments 'netlify build',
- # but only on pull requests, not issues.
+ # This 'if' now runs for the 'netlify build' comment OR any 'pull_request' event
if: |
- github.event.comment.body == 'netlify build'
- && github.event.issue.pull_request
+ (github.event.comment.body == 'netlify build' && github.event.issue.pull_request)
+ || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- # New step to check if the PR is from a forked repository.
- # If the PR is from a fork, doesn't run. Only runs for branches in the main repo.
- - name: Check if PR is from a fork
+ # We use `jq` to parse the GH API response
+ - name: Setup jq
+ uses: dcarbone/install-jq-action@v2
+
+ # This step is new. It gets all the PR info we need from EITHER trigger.
+ - name: Get PR Info
+ id: pr_info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
- PR_URL="${{ github.event.issue.pull_request.url }}"
- IS_FORK=$(gh api "$PR_URL" --jq '.head.repo.fork')
-
- if [[ "$IS_FORK" == "true" ]]; then
- echo "๐ Halting: This workflow only runs for branches in the main repository, not for forks."
- exit 1
- else
- echo "โ
PR is not from a fork. Proceeding with the job."
- fi
-
- - name: Check for member permission
+ # Get PR API URL from either 'issue_comment' or 'pull_request' event
+ gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
+ gh_api_response=$(gh api $gh_api_url)
+
+ branch_name=$(echo $gh_api_response | jq -r .head.ref)
+ sha=$(echo $gh_api_response | jq -r .head.sha)
+ pr_number=$(echo $gh_api_response | jq -r .number)
+ repo_full_name=$(echo $gh_api_response | jq -r .head.repo.full_name)
+
+ echo "branch=$branch_name" >> $GITHUB_OUTPUT
+ echo "sha=$sha" >> $GITHUB_OUTPUT
+ echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
+ echo "repo_full_name=$repo_full_name" >> $GITHUB_OUTPUT
+
+ # This step only runs if the trigger was a comment, to do the fork and perm checks.
+ - name: Check Permissions (if triggered by comment)
+ if: github.event_name == 'issue_comment'
env:
- GH_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
- id: check_permission
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ PERM_CHECK_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
uses: actions/github-script@v7
with:
- github-token: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
+ github-token: ${{ env.PERM_CHECK_TOKEN }}
script: |
+ // 1. Check for forks
+ const pr_url = "${{ github.event.issue.pull_request.url }}";
+ const pr_response = await github.request(`GET ${pr_url}`);
+ const is_fork = pr_response.data.head.repo.fork;
+
+ if (is_fork) {
+ core.setFailed("๐ Halting: This workflow only runs for branches in the main repository, not for forks.");
+ return;
+ }
+ console.log("โ
PR is not from a fork.");
+
+ // 2. Check for member permission
const commenter = context.payload.comment.user.login;
const org = context.repo.owner;
const team_slugs = ['doc', 'DOCS-ENG']; // <-- add your team slugs here
-
- console.log(`Organization: ${org}`);
- console.log(`Commenter: ${commenter}`);
-
- try {
- const user = await github.rest.users.getAuthenticated();
- console.log('Authenticated as:', user.data.login);
-
- const scopes = await github.request('GET /user');
- console.log('Token scopes:', scopes.headers['x-oauth-scopes']);
- } catch (error) {
- console.log('Auth check failed:', error.message);
- }
-
- // List all teams where the commenter is a member
- async function listUserTeams() {
- try {
- const teams = await github.paginate(github.rest.teams.listForAuthenticatedUser, {});
- const userTeams = teams.filter(team => team.organization.login.toLowerCase() === org.toLowerCase());
- if (userTeams.length === 0) {
- console.log(`${commenter} is not a member of any team in org ${org}.`);
- } else {
- console.log(`${commenter} is a member of the following teams in ${org}:`);
- userTeams.forEach(team => {
- console.log(`- ${team.slug} (${team.name})`);
- });
- }
- } catch (err) {
- console.log(`Could not list teams for user ${commenter}: ${err.message}`);
- }
- }
-
- await listUserTeams();
+
+ console.log(`Checking permissions for ${commenter} in ${org}...`);
async function isMemberOfAnyTeam() {
for (const team_slug of team_slugs) {
- console.log(`Checking team_slug: ${team_slug}`);
try {
const response = await github.rest.teams.getMembershipForUserInOrg({
org,
team_slug,
username: commenter,
});
- console.log(`API response for team_slug ${team_slug}:`, JSON.stringify(response.data, null, 2));
if (response.data.state === 'active') {
- console.log(`${commenter} is an active member of the ${team_slug} team.`);
+ console.log(`โ
${commenter} is an active member of the ${team_slug} team.`);
return true;
}
} catch (error) {
- console.log(`Error object for team_slug ${team_slug}:`, JSON.stringify(error, Object.getOwnPropertyNames(error)));
if (error.status !== 404) {
console.log(`Error checking team_slug ${team_slug}: ${error.message}`);
core.setFailed(`Could not verify team membership for ${team_slug}: ${error.message}`);
@@ -103,50 +93,112 @@ jobs:
return false;
}
- // Properly await the async function
const isMember = await isMemberOfAnyTeam();
if (!isMember) {
core.setFailed(`${commenter} is not a member of any required team (${team_slugs.join(', ')})`);
} else {
console.log(`โ
${commenter} is authorized to trigger builds`);
}
-
- # we use `jq` to parse the GH API response
- - name: setup jq
- uses: dcarbone/install-jq-action@v2
- - name: send request to Netlify build hook
- id: netlify_build
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com//')
- gh_api_response=$(gh api $gh_api_url)
- branch_name=$(echo $gh_api_response | jq -r .head.ref)
- sha=$(echo $gh_api_response | jq -r .head.sha)
- pr_number=$(echo $gh_api_response | jq -r .number)
+ # This is your new "pending" comment step, with a log link.
+ - name: Post "Pending" Comment
+ uses: thollander/actions-comment-pull-request@v2
+ with:
+ message: |
+ ### โณ Netlify Preview Deployment In Progress
+
+ Building preview for PR #${{ steps.pr_info.outputs.pr_number }} at commit `${{ steps.pr_info.outputs.sha }}`.
+ This comment will auto-update when the build is complete.
+
+ You can follow the build live [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
+ # This tag is CRUCIAL. It lets the final step find and replace this comment.
+ comment_tag: manual-build-comment
+
+ # We must check out the actual code from the PR head
+ - name: Checkout PR head
+ uses: actions/checkout@v4
+ with:
+ repository: ${{ steps.pr_info.outputs.repo_full_name }}
+ ref: ${{ steps.pr_info.outputs.sha }}
- echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ # Set this to the Node.js version your docs site uses
+ node-version: '18'
- curl -X POST \
- "https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK_ID }}?trigger_branch=$branch_name"'&trigger_title=Manual+deploy+preview+for+PR+%23'"$pr_number"'+-+'"$sha"
+ - name: Install Dependencies
+ # Update this if you use yarn or pnpm
+ run: npm ci
- # This step gets the branch name and replaces any non-alpha-numeric characters with '-' to match Netlify's URL format and capital letters to small case
- - name: Sanitize branch name for Netlify URL
- id: sanitize_branch
+ - name: Install Netlify CLI
+ run: npm install -g netlify-cli
+
+ # This is the new build step. It REPLACES your 'curl' step.
+ - name: Build and Deploy Preview
+ id: netlify_deploy
+ # This is CRUCIAL! It lets the next step run even if this one fails.
+ continue-on-error: true
+ env:
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
- # Replace all non-alphanumeric characters with '-' and convert to lowercase
- SANITIZED_BRANCH_NAME=$(echo "${{ steps.netlify_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
- echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
+ # --alias creates a predictable URL like: deploy-preview-123.netlify.app
+ # --json captures the output so we can parse it
+ deploy_output=$(netlify deploy --build --json --alias="deploy-preview-${{ steps.pr_info.outputs.pr_number }}" --message="Deploy preview for PR #${{ steps.pr_info.outputs.pr_number }}")
+
+ # Save the full output for debugging
+ echo "NETLIFY_DEPLOY_OUTPUT<> $GITHUB_ENV
+ echo "$deploy_output" >> $GITHUB_ENV
+ echo "EOF" >> $GITHUB_ENV
+
+ # Parse the JSON to get the URL
+ deploy_url=$(echo "$deploy_output" | jq -r .deploy_url)
+
+ # Pass the URL to the next step
+ echo "deploy_url=$deploy_url" >> $GITHUB_OUTPUT
+
+ # Check if 'deploy_url' is null or empty, which indicates a build failure
+ if [ -z "$deploy_url" ] || [ "$deploy_url" == "null" ]; then
+ echo "Build failed! No deploy_url returned."
+ # This ensures the 'outcome' of this step is 'failure'
+ exit 1
+ fi
- # This step now posts a comment with the dynamically constructed preview URL.
- - name: Add PR comment with preview URL
+ # This final step UPDATES the "pending" comment with the result
+ - name: Update PR comment with Build Status
uses: thollander/actions-comment-pull-request@v2
with:
+ # This tag finds the "pending" comment and replaces it
+ comment_tag: manual-build-comment
+ # This logic posts a different message based on the build step's outcome
message: |
- ### ๐ Netlify Preview Building!
+ ${{ steps.netlify_deploy.outcome == 'success' && format('### โ
Build Succeeded: Preview Ready!
+
+ Your deploy preview for PR #{0} is ready:
+ **Deploy URL: {1}**
+
+ > You can view the full build log for this deployment [here]({2}/{3}/actions/runs/{4}).', steps.pr_info.outputs.pr_number, steps.netlify_deploy.outputs.deploy_url, github.server_url, github.repository, github.run_id) || '' }}
+
+ ${{ steps.netlify_deploy.outcome != 'success' && format('### :rotating_light: **BUILD FAILED** :rotating_light:
+
+ :stop_sign: **DO NOT MERGE THIS PULL REQUEST.** :stop_sign:
+
+ The Netlify preview build failed for PR #{0} (commit `{1}`). Merging this **will** break the `develop` branch and cause downstream build failures.
+
+ **Action Required:**
+ 1. **[Click here to view the full build log]({2}/{3}/actions/runs/{4})**
+ 2. Click the **`deploy-preview`** job on the left.
+ 3. Expand the **`Build and Deploy Preview`** step to see the error.
+
+ Please review the logs, push a fix, and then trigger a new build by pushing your fix (or commenting `netlify build` if this is merged).
- If the build is successful, the preview for this pull request will be available at the following URL (usually takes 10-20 minutes):
+ ---
+
+ Raw Error Output (if available)
- **[https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app](https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app)**
- comment_tag: manual-build-comment
\ No newline at end of file
+ ```
+ {5}
+ ```
+
+ ', steps.pr_info.outputs.pr_number, steps.pr_info.outputs.sha, github.server_url, github.repository, github.run_id, env.NETLIFY_DEPLOY_OUTPUT) || '' }}
From bd5807ab117e785cae95008792b2ac5c41c45f72 Mon Sep 17 00:00:00 2001
From: Pranav Nandula <127438038+pranav-new-relic@users.noreply.github.com>
Date: Fri, 7 Nov 2025 17:49:26 +0530
Subject: [PATCH 03/43] chore: try making the workflow more resilient?
---
.../workflows/final-manual-deploy-comment.yml | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index db0b011e06c..9850379916f 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -127,9 +127,22 @@ jobs:
# Set this to the Node.js version your docs site uses
node-version: '18'
+ # THIS IS THE MODIFIED STEP
- name: Install Dependencies
- # Update this if you use yarn or pnpm
- run: npm ci
+ run: |
+ if [ -f yarn.lock ]; then
+ echo "Detected yarn.lock, using yarn install"
+ yarn install --frozen-lockfile
+ elif [ -f pnpm-lock.yaml ]; then
+ echo "Detected pnpm-lock.yaml, using pnpm install"
+ pnpm install --frozen-lockfile
+ elif [ -f package-lock.json ]; then
+ echo "Detected package-lock.json, using npm ci"
+ npm ci
+ else
+ echo "No lockfile detected, using npm install"
+ npm install
+ fi
- name: Install Netlify CLI
run: npm install -g netlify-cli
From 7067c956a86df32ea837975539467e4cfcb01a8e Mon Sep 17 00:00:00 2001
From: Pranav Nandula <127438038+pranav-new-relic@users.noreply.github.com>
Date: Fri, 7 Nov 2025 18:25:26 +0530
Subject: [PATCH 04/43] chore: breaking the infinite loop of build, by
splitting build and deploy commands
---
.../workflows/final-manual-deploy-comment.yml | 22 ++++++++++++++-----
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 9850379916f..8a011a12c1d 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -113,6 +113,8 @@ jobs:
You can follow the build live [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
# This tag is CRUCIAL. It lets the final step find and replace this comment.
comment_tag: manual-build-comment
+ # THIS IS THE FIX for the pending comment
+ github_token: ${{ secrets.GITHUB_TOKEN }}
# We must check out the actual code from the PR head
- name: Checkout PR head
@@ -127,7 +129,6 @@ jobs:
# Set this to the Node.js version your docs site uses
node-version: '18'
- # THIS IS THE MODIFIED STEP
- name: Install Dependencies
run: |
if [ -f yarn.lock ]; then
@@ -147,7 +148,7 @@ jobs:
- name: Install Netlify CLI
run: npm install -g netlify-cli
- # This is the new build step. It REPLACES your 'curl' step.
+ # THIS STEP IS NOW SEPARATED INTO BUILD AND DEPLOY
- name: Build and Deploy Preview
id: netlify_deploy
# This is CRUCIAL! It lets the next step run even if this one fails.
@@ -156,9 +157,16 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
- # --alias creates a predictable URL like: deploy-preview-123.netlify.app
- # --json captures the output so we can parse it
- deploy_output=$(netlify deploy --build --json --alias="deploy-preview-${{ steps.pr_info.outputs.pr_number }}" --message="Deploy preview for PR #${{ steps.pr_info.outputs.pr_number }}")
+ # Step 1: Run the build. This WILL stream logs.
+ # If this fails, the 'continue-on-error' will catch it, and the
+ # 'Update PR comment' step will report the failure.
+ echo "Running Netlify Build... (logs will stream)"
+ netlify build
+
+ # Step 2: If build succeeded, deploy the site.
+ # This is fast and can safely use --json.
+ echo "Deploying to Netlify..."
+ deploy_output=$(netlify deploy --json --alias="deploy-preview-${{ steps.pr_info.outputs.pr_number }}" --message="Deploy preview for PR #${{ steps.pr_info.outputs.pr_number }}")
# Save the full output for debugging
echo "NETLIFY_DEPLOY_OUTPUT<> $GITHUB_ENV
@@ -173,7 +181,7 @@ jobs:
# Check if 'deploy_url' is null or empty, which indicates a build failure
if [ -z "$deploy_url" ] || [ "$deploy_url" == "null" ]; then
- echo "Build failed! No deploy_url returned."
+ echo "Build failed or deploy_url not found!"
# This ensures the 'outcome' of this step is 'failure'
exit 1
fi
@@ -184,6 +192,8 @@ jobs:
with:
# This tag finds the "pending" comment and replaces it
comment_tag: manual-build-comment
+ # THIS IS THE FIX for the final comment
+ github_token: ${{ secrets.GITHUB_TOKEN }}
# This logic posts a different message based on the build step's outcome
message: |
${{ steps.netlify_deploy.outcome == 'success' && format('### โ
Build Succeeded: Preview Ready!
From 14f3427ffe3fb970159bc30b5b94083837b0570c Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 00:43:58 +0530
Subject: [PATCH 05/43] chore: test PR v2, build break test with 31st June: DO
NOT MERGE
---
.../workflows/final-manual-deploy-comment.yml | 228 +++++++++---------
1 file changed, 111 insertions(+), 117 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 8a011a12c1d..5c3b5b47660 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -20,29 +20,8 @@ jobs:
- name: Setup jq
uses: dcarbone/install-jq-action@v2
- # This step is new. It gets all the PR info we need from EITHER trigger.
- - name: Get PR Info
- id: pr_info
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- # Get PR API URL from either 'issue_comment' or 'pull_request' event
- gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
- gh_api_response=$(gh api $gh_api_url)
-
- branch_name=$(echo $gh_api_response | jq -r .head.ref)
- sha=$(echo $gh_api_response | jq -r .head.sha)
- pr_number=$(echo $gh_api_response | jq -r .number)
- repo_full_name=$(echo $gh_api_response | jq -r .head.repo.full_name)
-
- echo "branch=$branch_name" >> $GITHUB_OUTPUT
- echo "sha=$sha" >> $GITHUB_OUTPUT
- echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
- echo "repo_full_name=$repo_full_name" >> $GITHUB_OUTPUT
-
# This step only runs if the trigger was a comment, to do the fork and perm checks.
- - name: Check Permissions (if triggered by comment)
- if: github.event_name == 'issue_comment'
+ - name: Check Permissions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERM_CHECK_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
@@ -86,7 +65,6 @@ jobs:
core.setFailed(`Could not verify team membership for ${team_slug}: ${error.message}`);
return false;
}
- // If 404, user is not in this team, continue to next
console.log(`${commenter} is not a member of ${team_slug} (404)`);
}
}
@@ -99,129 +77,145 @@ jobs:
} else {
console.log(`โ
${commenter} is authorized to trigger builds`);
}
+
+ # This step REPLACES the old build hook 'curl' command.
+ # It uses the Netlify API to trigger a build and get the build/deploy IDs.
+ - name: Trigger Netlify Build
+ id: trigger_build
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} # <-- MUST ADD THIS SECRET
+ run: |
+ # 1. Get PR info
+ gh_api_url=$(echo ${{ github.event.issue.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
+ gh_api_response=$(gh api $gh_api_url)
+ branch_name=$(echo $gh_api_response | jq -r .head.ref)
+ sha=$(echo $gh_api_response | jq -r .head.sha)
+ pr_number=$(echo $gh_api_response | jq -r .number)
- # This is your new "pending" comment step, with a log link.
+ echo "Triggering build for branch $branch_name (SHA: $sha)..."
+
+ # 2. Create the JSON payload for the Netlify API
+ json_payload=$(jq -n \
+ --arg branch "$branch_name" \
+ --arg sha "$sha" \
+ --arg title "Manual deploy preview for PR #$pr_number - $sha" \
+ '{ "branch": $branch, "sha": $sha, "deploy_context": "branch-deploy", "clear_cache": false, "title": $title }')
+
+ # 3. Call the Netlify API to trigger the build
+ response=$(curl -s -X POST "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/builds" \
+ -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d "$json_payload")
+
+ # 4. Parse the response to get the IDs
+ build_id=$(echo $response | jq -r .build_id)
+ deploy_id=$(echo $response | jq -r .deploy_id)
+
+ if [ -z "$build_id" ] || [ "$build_id" == "null" ]; then
+ echo "::error::Failed to trigger Netlify build. Response:"
+ echo $response
+ exit 1
+ fi
+
+ echo "โ
Build triggered!"
+ echo "Build ID: $build_id"
+ echo "Deploy ID: $deploy_id"
+
+ # 5. Pass outputs to other steps
+ echo "build_id=$build_id" >> $GITHUB_OUTPUT
+ echo "deploy_id=$deploy_id" >> $GITHUB_OUTPUT
+ echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+ echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
+
+ # This step gets the branch name for the final URL
+ - name: Sanitize branch name for Netlify URL
+ id: sanitize_branch
+ run: |
+ SANITIZED_BRANCH_NAME=$(echo "${{ steps.trigger_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
+ echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
+
+ # This step posts the INITIAL "pending" comment with a link to the Netlify log
- name: Post "Pending" Comment
uses: thollander/actions-comment-pull-request@v2
with:
message: |
- ### โณ Netlify Preview Deployment In Progress
+ ### โณ Netlify Preview Build Triggered
- Building preview for PR #${{ steps.pr_info.outputs.pr_number }} at commit `${{ steps.pr_info.outputs.sha }}`.
- This comment will auto-update when the build is complete.
+ Building preview for PR #${{ steps.trigger_build.outputs.pr_number }}.
+ This comment will auto-update when the build is complete (usually 15-20 minutes).
- You can follow the build live [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
- # This tag is CRUCIAL. It lets the final step find and replace this comment.
+ **You can follow the live build log on Netlify:**
+ **[https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.trigger_build.outputs.deploy_id }}](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.trigger_build.outputs.deploy_id }})**
comment_tag: manual-build-comment
- # THIS IS THE FIX for the pending comment
github_token: ${{ secrets.GITHUB_TOKEN }}
- # We must check out the actual code from the PR head
- - name: Checkout PR head
- uses: actions/checkout@v4
- with:
- repository: ${{ steps.pr_info.outputs.repo_full_name }}
- ref: ${{ steps.pr_info.outputs.sha }}
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- # Set this to the Node.js version your docs site uses
- node-version: '18'
-
- - name: Install Dependencies
- run: |
- if [ -f yarn.lock ]; then
- echo "Detected yarn.lock, using yarn install"
- yarn install --frozen-lockfile
- elif [ -f pnpm-lock.yaml ]; then
- echo "Detected pnpm-lock.yaml, using pnpm install"
- pnpm install --frozen-lockfile
- elif [ -f package-lock.json ]; then
- echo "Detected package-lock.json, using npm ci"
- npm ci
- else
- echo "No lockfile detected, using npm install"
- npm install
- fi
-
- - name: Install Netlify CLI
- run: npm install -g netlify-cli
-
- # THIS STEP IS NOW SEPARATED INTO BUILD AND DEPLOY
- - name: Build and Deploy Preview
- id: netlify_deploy
- # This is CRUCIAL! It lets the next step run even if this one fails.
- continue-on-error: true
+ # This NEW step polls the Netlify API for the build status
+ - name: Poll Netlify Build Status
+ id: poll_build
env:
- NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
- # Step 1: Run the build. This WILL stream logs.
- # If this fails, the 'continue-on-error' will catch it, and the
- # 'Update PR comment' step will report the failure.
- echo "Running Netlify Build... (logs will stream)"
- netlify build
-
- # Step 2: If build succeeded, deploy the site.
- # This is fast and can safely use --json.
- echo "Deploying to Netlify..."
- deploy_output=$(netlify deploy --json --alias="deploy-preview-${{ steps.pr_info.outputs.pr_number }}" --message="Deploy preview for PR #${{ steps.pr_info.outputs.pr_number }}")
-
- # Save the full output for debugging
- echo "NETLIFY_DEPLOY_OUTPUT<> $GITHUB_ENV
- echo "$deploy_output" >> $GITHUB_ENV
- echo "EOF" >> $GITHUB_ENV
-
- # Parse the JSON to get the URL
- deploy_url=$(echo "$deploy_output" | jq -r .deploy_url)
-
- # Pass the URL to the next step
- echo "deploy_url=$deploy_url" >> $GITHUB_OUTPUT
+ build_id="${{ steps.trigger_build.outputs.build_id }}"
+ timeout=2700 # 45 minutes (2700s)
+ interval=30 # Poll every 30 seconds
+ elapsed=0
- # Check if 'deploy_url' is null or empty, which indicates a build failure
- if [ -z "$deploy_url" ] || [ "$deploy_url" == "null" ]; then
- echo "Build failed or deploy_url not found!"
- # This ensures the 'outcome' of this step is 'failure'
- exit 1
- fi
+ echo "Polling build status for Build ID: $build_id..."
+
+ while [ $elapsed -lt $timeout ]; do
+ response=$(curl -s "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/builds/$build_id" -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN")
+ state=$(echo $response | jq -r .state)
+ deploy_id=$(echo $response | jq -r .deploy_id) # Get the latest deploy_id, just in case
+
+ echo "Current build state: $state (Elapsed: $elapsed s)"
+
+ if [ "$state" == "done" ]; then
+ echo "โ
Build succeeded!"
+ echo "build_state=done" >> $GITHUB_OUTPUT
+ echo "final_deploy_id=$deploy_id" >> $GITHUB_OUTPUT
+ exit 0
+ elif [ "$state" == "error" ] || [ "$state" == "cancelled" ]; then
+ echo "::error::Build failed with state: $state"
+ echo "build_state=$state" >> $GITHUB_OUTPUT
+ echo "final_deploy_id=$deploy_id" >> $GITHUB_OUTPUT
+ exit 0 # Exit successfully so the *next* step can post the failure comment
+ fi
+
+ sleep $interval
+ elapsed=$((elapsed + interval))
+ done
+
+ echo "::error::Build timed out after 45 minutes."
+ echo "build_state=timeout" >> $GITHUB_OUTPUT
+ echo "final_deploy_id=${{ steps.trigger_build.outputs.deploy_id }}" >> $GITHUB_OUTPUT # Use original deploy_id
+ exit 0 # Exit successfully so the next step can post the timeout failure
# This final step UPDATES the "pending" comment with the result
- name: Update PR comment with Build Status
uses: thollander/actions-comment-pull-request@v2
with:
- # This tag finds the "pending" comment and replaces it
comment_tag: manual-build-comment
- # THIS IS THE FIX for the final comment
github_token: ${{ secrets.GITHUB_TOKEN }}
- # This logic posts a different message based on the build step's outcome
message: |
- ${{ steps.netlify_deploy.outcome == 'success' && format('### โ
Build Succeeded: Preview Ready!
+ ${{ steps.poll_build.outputs.build_state == 'done' && format('### โ
Build Succeeded: Preview Ready!
Your deploy preview for PR #{0} is ready:
- **Deploy URL: {1}**
+ **Preview URL: [https://{1}--docs-website-netlify.netlify.app](https://{1}--docs-website-netlify.netlify.app)**
- > You can view the full build log for this deployment [here]({2}/{3}/actions/runs/{4}).', steps.pr_info.outputs.pr_number, steps.netlify_deploy.outputs.deploy_url, github.server_url, github.repository, github.run_id) || '' }}
+ > You can view the final deploy log on Netlify [here](https://app.netlify.com/sites/{2}/deploys/{3}).', steps.trigger_build.outputs.pr_number, steps.sanitize_branch.outputs.name, secrets.NETLIFY_SITE_ID, steps.poll_build.outputs.final_deploy_id) || '' }}
- ${{ steps.netlify_deploy.outcome != 'success' && format('### :rotating_light: **BUILD FAILED** :rotating_light:
+ ${{ steps.poll_build.outputs.build_state != 'done' && format('### :rotating_light: **BUILD FAILED** :rotating_light:
:stop_sign: **DO NOT MERGE THIS PULL REQUEST.** :stop_sign:
- The Netlify preview build failed for PR #{0} (commit `{1}`). Merging this **will** break the `develop` branch and cause downstream build failures.
+ The Netlify preview build failed for PR #{0} with state: `{1}`. Merging this **will** break the `develop` branch.
**Action Required:**
- 1. **[Click here to view the full build log]({2}/{3}/actions/runs/{4})**
- 2. Click the **`deploy-preview`** job on the left.
- 3. Expand the **`Build and Deploy Preview`** step to see the error.
+ 1. **[Click here to view the full Netlify build log]({2}/sites/{3}/deploys/{4})**
+ 2. Review the errors, push a fix to this PR.
+ 3. Comment `netlify build` again to trigger a new build.
- Please review the logs, push a fix, and then trigger a new build by pushing your fix (or commenting `netlify build` if this is merged).
-
- ---
-
- Raw Error Output (if available)
-
- ```
- {5}
- ```
-
- ', steps.pr_info.outputs.pr_number, steps.pr_info.outputs.sha, github.server_url, github.repository, github.run_id, env.NETLIFY_DEPLOY_OUTPUT) || '' }}
+ > GitHub Action log for this job: [{5}/actions/runs/{6}](https://{5}/actions/runs/{6})', steps.trigger_build.outputs.pr_number, steps.poll_build.outputs.build_state, 'https://app.netlify.com', secrets.NETLIFY_SITE_ID, steps.poll_build.outputs.final_deploy_id, github.repository, github.run_id) || '' }}
From e8b32c122816e2ab0572d714191b8bac2a244ed3 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 01:03:23 +0530
Subject: [PATCH 06/43] chore: optimize workflow?
---
.../workflows/final-manual-deploy-comment.yml | 429 ++++++++++++------
1 file changed, 300 insertions(+), 129 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 5c3b5b47660..a455ff22f11 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -16,206 +16,377 @@ jobs:
runs-on: ubuntu-latest
steps:
- # We use `jq` to parse the GH API response
- - name: Setup jq
- uses: dcarbone/install-jq-action@v2
-
- # This step only runs if the trigger was a comment, to do the fork and perm checks.
- - name: Check Permissions
+ # New step to check if the PR is from a forked repository.
+ # If the PR is from a fork, doesn't run. Only runs for branches in the main repo.
+ - name: Check if PR is from a fork
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PERM_CHECK_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
+ run: |
+ PR_URL="${{ github.event.issue.pull_request.url }}"
+ IS_FORK=$(gh api "$PR_URL" --jq '.head.repo.fork')
+
+ if [[ "$IS_FORK" == "true" ]]; then
+ echo "๐ Halting: This workflow only runs for branches in the main repository, not for forks."
+ exit 1
+ else
+ echo "โ
PR is not from a fork. Proceeding with the job."
+ fi
+
+ - name: Check for member permission
+ env:
+ GH_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
+ id: check_permission
uses: actions/github-script@v7
with:
- github-token: ${{ env.PERM_CHECK_TOKEN }}
+ github-token: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
script: |
- // 1. Check for forks
- const pr_url = "${{ github.event.issue.pull_request.url }}";
- const pr_response = await github.request(`GET ${pr_url}`);
- const is_fork = pr_response.data.head.repo.fork;
-
- if (is_fork) {
- core.setFailed("๐ Halting: This workflow only runs for branches in the main repository, not for forks.");
- return;
- }
- console.log("โ
PR is not from a fork.");
-
- // 2. Check for member permission
const commenter = context.payload.comment.user.login;
const org = context.repo.owner;
const team_slugs = ['doc', 'DOCS-ENG']; // <-- add your team slugs here
-
- console.log(`Checking permissions for ${commenter} in ${org}...`);
+
+ console.log(`Organization: ${org}`);
+ console.log(`Commenter: ${commenter}`);
+
+ try {
+ const user = await github.rest.users.getAuthenticated();
+ console.log('Authenticated as:', user.data.login);
+
+ const scopes = await github.request('GET /user');
+ console.log('Token scopes:', scopes.headers['x-oauth-scopes']);
+ } catch (error) {
+ console.log('Auth check failed:', error.message);
+ }
+
+ // List all teams where the commenter is a member
+ async function listUserTeams() {
+ try {
+ const teams = await github.paginate(github.rest.teams.listForAuthenticatedUser, {});
+ const userTeams = teams.filter(team => team.organization.login.toLowerCase() === org.toLowerCase());
+ if (userTeams.length === 0) {
+ console.log(`${commenter} is not a member of any team in org ${org}.`);
+ } else {
+ console.log(`${commenter} is a member of the following teams in ${org}:`);
+ userTeams.forEach(team => {
+ console.log(`- ${team.slug} (${team.name})`);
+ });
+ }
+ } catch (err) {
+ console.log(`Could not list teams for user ${commenter}: ${err.message}`);
+ }
+ }
+
+ await listUserTeams();
async function isMemberOfAnyTeam() {
for (const team_slug of team_slugs) {
+ console.log(`Checking team_slug: ${team_slug}`);
try {
const response = await github.rest.teams.getMembershipForUserInOrg({
org,
team_slug,
username: commenter,
});
+ console.log(`API response for team_slug ${team_slug}:`, JSON.stringify(response.data, null, 2));
if (response.data.state === 'active') {
- console.log(`โ
${commenter} is an active member of the ${team_slug} team.`);
+ console.log(`${commenter} is an active member of the ${team_slug} team.`);
return true;
}
} catch (error) {
+ console.log(`Error object for team_slug ${team_slug}:`, JSON.stringify(error, Object.getOwnPropertyNames(error)));
if (error.status !== 404) {
console.log(`Error checking team_slug ${team_slug}: ${error.message}`);
core.setFailed(`Could not verify team membership for ${team_slug}: ${error.message}`);
return false;
}
+ // If 404, user is not in this team, continue to next
console.log(`${commenter} is not a member of ${team_slug} (404)`);
}
}
return false;
}
+ // Properly await the async function
const isMember = await isMemberOfAnyTeam();
if (!isMember) {
core.setFailed(`${commenter} is not a member of any required team (${team_slugs.join(', ')})`);
} else {
console.log(`โ
${commenter} is authorized to trigger builds`);
}
-
- # This step REPLACES the old build hook 'curl' command.
- # It uses the Netlify API to trigger a build and get the build/deploy IDs.
- - name: Trigger Netlify Build
- id: trigger_build
- env:
+
+ # we use `jq` to parse the GH API response
+ - name: setup jq
+ uses: dcarbone/install-jq-action@v2
+
+ - name: send request to Netlify build hook
+ id: netlify_build
+ env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} # <-- MUST ADD THIS SECRET
run: |
- # 1. Get PR info
- gh_api_url=$(echo ${{ github.event.issue.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
+ gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com//')
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
sha=$(echo $gh_api_response | jq -r .head.sha)
pr_number=$(echo $gh_api_response | jq -r .number)
- echo "Triggering build for branch $branch_name (SHA: $sha)..."
-
- # 2. Create the JSON payload for the Netlify API
- json_payload=$(jq -n \
- --arg branch "$branch_name" \
- --arg sha "$sha" \
- --arg title "Manual deploy preview for PR #$pr_number - $sha" \
- '{ "branch": $branch, "sha": $sha, "deploy_context": "branch-deploy", "clear_cache": false, "title": $title }')
-
- # 3. Call the Netlify API to trigger the build
- response=$(curl -s -X POST "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/builds" \
- -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
- -H "Content-Type: application/json" \
- -d "$json_payload")
-
- # 4. Parse the response to get the IDs
- build_id=$(echo $response | jq -r .build_id)
- deploy_id=$(echo $response | jq -r .deploy_id)
-
- if [ -z "$build_id" ] || [ "$build_id" == "null" ]; then
- echo "::error::Failed to trigger Netlify build. Response:"
- echo $response
- exit 1
- fi
-
- echo "โ
Build triggered!"
- echo "Build ID: $build_id"
- echo "Deploy ID: $deploy_id"
-
- # 5. Pass outputs to other steps
- echo "build_id=$build_id" >> $GITHUB_OUTPUT
- echo "deploy_id=$deploy_id" >> $GITHUB_OUTPUT
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
+ echo "sha=$sha" >> $GITHUB_OUTPUT
+
+ # Capture the timestamp before triggering the build
+ TRIGGER_TIME=$(date -u +%s)
+ echo "trigger_time=$TRIGGER_TIME" >> $GITHUB_OUTPUT
+
+ echo "๐ Triggering Netlify build for branch: $branch_name"
+ echo "๐ PR #$pr_number | Commit: $sha"
- # This step gets the branch name for the final URL
+ curl -X POST \
+ "https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK_ID }}?trigger_branch=$branch_name"'&trigger_title=Manual+deploy+preview+for+PR+%23'"$pr_number"'+-+'"$sha"
+
+ echo "โ
Build hook triggered successfully"
+
+ # This step gets the branch name and replaces any non-alpha-numeric characters with '-' to match Netlify's URL format and capital letters to small case
- name: Sanitize branch name for Netlify URL
id: sanitize_branch
run: |
- SANITIZED_BRANCH_NAME=$(echo "${{ steps.trigger_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
+ # Replace all non-alphanumeric characters with '-' and convert to lowercase
+ SANITIZED_BRANCH_NAME=$(echo "${{ steps.netlify_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- # This step posts the INITIAL "pending" comment with a link to the Netlify log
- - name: Post "Pending" Comment
+ # This step now posts a comment with the dynamically constructed preview URL.
+ - name: Add PR comment with preview URL
uses: thollander/actions-comment-pull-request@v2
with:
message: |
- ### โณ Netlify Preview Build Triggered
-
- Building preview for PR #${{ steps.trigger_build.outputs.pr_number }}.
- This comment will auto-update when the build is complete (usually 15-20 minutes).
+ ### ๐ Netlify Preview Building!
- **You can follow the live build log on Netlify:**
- **[https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.trigger_build.outputs.deploy_id }}](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.trigger_build.outputs.deploy_id }})**
+ Build triggered for PR #${{ steps.netlify_build.outputs.pr_number }} (commit: `${{ steps.netlify_build.outputs.sha }}`)
+
+ โณ Monitoring deployment status... This usually takes 10-20 minutes.
comment_tag: manual-build-comment
- github_token: ${{ secrets.GITHUB_TOKEN }}
- # This NEW step polls the Netlify API for the build status
- - name: Poll Netlify Build Status
- id: poll_build
+ # Poll Netlify API to check deployment status
+ - name: Poll Netlify deployment status
+ id: poll_netlify
env:
- NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
- build_id="${{ steps.trigger_build.outputs.build_id }}"
- timeout=2700 # 45 minutes (2700s)
- interval=30 # Poll every 30 seconds
- elapsed=0
+ BRANCH_NAME="${{ steps.netlify_build.outputs.branch_name }}"
+ TRIGGER_TIME="${{ steps.netlify_build.outputs.trigger_time }}"
+ SHA="${{ steps.netlify_build.outputs.sha }}"
+ MAX_WAIT_TIME=1800 # 30 minutes
+ POLL_INTERVAL=30 # 30 seconds
+ ELAPSED_TIME=0
+ DEPLOY_ID=""
+
+ echo "๐ Starting deployment tracking..."
+ echo "๐ Branch: $BRANCH_NAME"
+ echo "๐ Commit SHA: $SHA"
+ echo "โฐ Trigger time: $TRIGGER_TIME"
- echo "Polling build status for Build ID: $build_id..."
-
- while [ $elapsed -lt $timeout ]; do
- response=$(curl -s "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/builds/$build_id" -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN")
- state=$(echo $response | jq -r .state)
- deploy_id=$(echo $response | jq -r .deploy_id) # Get the latest deploy_id, just in case
-
- echo "Current build state: $state (Elapsed: $elapsed s)"
-
- if [ "$state" == "done" ]; then
- echo "โ
Build succeeded!"
- echo "build_state=done" >> $GITHUB_OUTPUT
- echo "final_deploy_id=$deploy_id" >> $GITHUB_OUTPUT
- exit 0
- elif [ "$state" == "error" ] || [ "$state" == "cancelled" ]; then
- echo "::error::Build failed with state: $state"
- echo "build_state=$state" >> $GITHUB_OUTPUT
- echo "final_deploy_id=$deploy_id" >> $GITHUB_OUTPUT
- exit 0 # Exit successfully so the *next* step can post the failure comment
+ # Wait a few seconds for Netlify to create the deployment
+ echo "โณ Waiting 10 seconds for Netlify to register the deployment..."
+ sleep 10
+
+ # First, find the specific deployment ID that was just triggered
+ echo "๐ Looking for the deployment triggered by this workflow run..."
+ for i in {1..10}; do
+ echo "๐ Attempt $i/10 to find deployment..."
+
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
+
+ # Find deployment matching our branch and created after trigger time
+ # We look for deployments with our exact commit SHA for precision
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" --arg sha "$SHA" \
+ '[.[] | select(.branch == $branch and (.commit_ref == $sha or .head == $sha))] |
+ sort_by(.created_at) | reverse | .[0]')
+
+ if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
+ DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
+ CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
+ CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
+
+ # Check if deployment was created after (or very close to) our trigger time
+ TIME_DIFF=$((CREATED_TIMESTAMP - TRIGGER_TIME))
+
+ if [ $TIME_DIFF -ge -5 ]; then
+ echo "โ
Found target deployment!"
+ echo "๐ Deploy ID: $DEPLOY_ID"
+ echo "๐
Created at: $CREATED_AT"
+ break
+ else
+ echo "โ ๏ธ Found deployment but it's too old (created ${TIME_DIFF}s before trigger)"
+ fi
+ fi
+
+ if [ $i -lt 10 ]; then
+ echo "โณ Deployment not found yet, waiting 5 seconds..."
+ sleep 5
fi
-
- sleep $interval
- elapsed=$((elapsed + interval))
done
+
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+ echo "โ Could not find deployment after 10 attempts"
+ echo "๐ Falling back to branch-based tracking..."
+ # Fallback: track by branch name only
+ USE_FALLBACK=true
+ else
+ echo "๐ฏ Locked onto deployment ID: $DEPLOY_ID"
+ USE_FALLBACK=false
+ fi
+
+ # Now poll the specific deployment until completion
+ echo ""
+ echo "๐ Starting status monitoring..."
+ ELAPSED_TIME=0
+
+ while [ $ELAPSED_TIME -lt $MAX_WAIT_TIME ]; do
+ echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${ELAPSED_TIME}s / ${MAX_WAIT_TIME}s)"
+
+ if [ "$USE_FALLBACK" = "true" ]; then
+ # Fallback: Get latest deployment for branch
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
+
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+ else
+ # Primary: Get specific deployment by ID
+ DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
+ fi
+
+ if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
+ STATE=$(echo "$DEPLOY" | jq -r '.state')
+ CURRENT_DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
+ DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
+ ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
+
+ # Update DEPLOY_ID if we were using fallback
+ if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
+ DEPLOY_ID=$CURRENT_DEPLOY_ID
+ echo "๐ Deployment ID: $DEPLOY_ID"
+ fi
+
+ echo "๐ Current state: $STATE"
+
+ if [ "$STATE" = "ready" ]; then
+ echo "โ
Deployment successful!"
+ echo "๐ URL: $DEPLOY_URL"
+ echo "status=success" >> $GITHUB_OUTPUT
+ echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ exit 0
+ elif [ "$STATE" = "error" ]; then
+ echo "โ Deployment failed!"
+ echo "๐ฅ Error: $ERROR_MESSAGE"
+ echo "status=failure" >> $GITHUB_OUTPUT
+ echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ exit 0
+ elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
+ echo "โณ Deployment in progress (state: $STATE)..."
+ else
+ echo "โ ๏ธ Unknown state: $STATE"
+ fi
+ else
+ echo "โ No deployment data returned from Netlify API"
+ fi
+
+ sleep $POLL_INTERVAL
+ ELAPSED_TIME=$((ELAPSED_TIME + POLL_INTERVAL))
+ done
+
+ echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
+ echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
+ echo "status=timeout" >> $GITHUB_OUTPUT
- echo "::error::Build timed out after 45 minutes."
- echo "build_state=timeout" >> $GITHUB_OUTPUT
- echo "final_deploy_id=${{ steps.trigger_build.outputs.deploy_id }}" >> $GITHUB_OUTPUT # Use original deploy_id
- exit 0 # Exit successfully so the next step can post the timeout failure
-
- # This final step UPDATES the "pending" comment with the result
- - name: Update PR comment with Build Status
+ # Post success comment
+ - name: Post success comment
+ if: steps.poll_netlify.outputs.status == 'success'
uses: thollander/actions-comment-pull-request@v2
with:
- comment_tag: manual-build-comment
- github_token: ${{ secrets.GITHUB_TOKEN }}
message: |
- ${{ steps.poll_build.outputs.build_state == 'done' && format('### โ
Build Succeeded: Preview Ready!
-
- Your deploy preview for PR #{0} is ready:
- **Preview URL: [https://{1}--docs-website-netlify.netlify.app](https://{1}--docs-website-netlify.netlify.app)**
-
- > You can view the final deploy log on Netlify [here](https://app.netlify.com/sites/{2}/deploys/{3}).', steps.trigger_build.outputs.pr_number, steps.sanitize_branch.outputs.name, secrets.NETLIFY_SITE_ID, steps.poll_build.outputs.final_deploy_id) || '' }}
+ ### โ
Netlify Preview Deploy Successful!
- ${{ steps.poll_build.outputs.build_state != 'done' && format('### :rotating_light: **BUILD FAILED** :rotating_light:
+ Your preview deployment has completed successfully and is now live!
- :stop_sign: **DO NOT MERGE THIS PULL REQUEST.** :stop_sign:
+ ๐ **Preview URL:** [${{ steps.poll_netlify.outputs.deploy_url }}](${{ steps.poll_netlify.outputs.deploy_url }})
+
+ ๐ฆ **Deploy ID:** `${{ steps.poll_netlify.outputs.deploy_id }}`
+
+ The preview is ready for review. Please test your changes thoroughly before merging.
+ comment_tag: manual-build-comment
- The Netlify preview build failed for PR #{0} with state: `{1}`. Merging this **will** break the `develop` branch.
+ # Post failure comment
+ - name: Post failure comment
+ if: steps.poll_netlify.outputs.status == 'failure'
+ uses: thollander/actions-comment-pull-request@v2
+ with:
+ message: |
+ # ๐จ โ 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:** `${{ steps.poll_netlify.outputs.deploy_id }}`
+ - **Error Message:**
+ ```
+ ${{ steps.poll_netlify.outputs.error_message }}
+ ```
+
+ ### ๐ ๏ธ 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 ๐ด**
+ comment_tag: manual-build-comment
- **Action Required:**
- 1. **[Click here to view the full Netlify build log]({2}/sites/{3}/deploys/{4})**
- 2. Review the errors, push a fix to this PR.
- 3. Comment `netlify build` again to trigger a new build.
+ # Post timeout comment
+ - name: Post timeout comment
+ if: steps.poll_netlify.outputs.status == 'timeout'
+ uses: thollander/actions-comment-pull-request@v2
+ with:
+ message: |
+ ### โฑ๏ธ Netlify Deployment Status: Timeout
+
+ โ ๏ธ The deployment is taking longer than expected (>30 minutes).
- > GitHub Action log for this job: [{5}/actions/runs/{6}](https://{5}/actions/runs/{6})', steps.trigger_build.outputs.pr_number, steps.poll_build.outputs.build_state, 'https://app.netlify.com', secrets.NETLIFY_SITE_ID, steps.poll_build.outputs.final_deploy_id, github.repository, github.run_id) || '' }}
+ **Possible reasons:**
+ - The build is still in progress
+ - Netlify is experiencing delays
+ - The build queue is backed up
+
+ **Next steps:**
+ 1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status
+ 2. Look for branch: `${{ steps.netlify_build.outputs.branch_name }}`
+ 3. If the build is still running, please wait for it to complete
+ 4. If needed, you can re-trigger with another `netlify build` comment
+
+ **Expected preview URL (once ready):**
+ https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app
+ comment_tag: manual-build-comment
+
+ # Fail the workflow if deployment failed
+ - name: Fail workflow on deployment failure
+ if: steps.poll_netlify.outputs.status == 'failure'
+ run: |
+ echo "::error::Netlify deployment failed. This PR should not be merged."
+ exit 1
\ No newline at end of file
From 45f85f934fd23429901ffe412738bd82cbc29587 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 01:08:45 +0530
Subject: [PATCH 07/43] chore: fix forked member check part of the workflow?
---
.../workflows/final-manual-deploy-comment.yml | 40 +++++++++++--------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index a455ff22f11..328975a33cd 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -33,6 +33,13 @@ jobs:
fi
- name: Check for member permission
+ # Only run this check for issue_comment events (manual triggers)
+ # For pull_request events, the PR author is implicitly authorized
+
+ # ##########################################################################################
+ # REMOVE THIS CONDITION AFTER TESTING THIS WORKFLOW, THIS SHOULD NOT MAKE IT TO THE MERGE
+ # ##########################################################################################
+ if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
id: check_permission
@@ -44,17 +51,18 @@ jobs:
const org = context.repo.owner;
const team_slugs = ['doc', 'DOCS-ENG']; // <-- add your team slugs here
- console.log(`Organization: ${org}`);
- console.log(`Commenter: ${commenter}`);
+ console.log(`๐ Checking permissions...`);
+ console.log(`๐ Organization: ${org}`);
+ console.log(`๐ค Commenter: ${commenter}`);
try {
const user = await github.rest.users.getAuthenticated();
- console.log('Authenticated as:', user.data.login);
+ console.log('๐ Authenticated as:', user.data.login);
const scopes = await github.request('GET /user');
- console.log('Token scopes:', scopes.headers['x-oauth-scopes']);
+ console.log('๐ซ Token scopes:', scopes.headers['x-oauth-scopes']);
} catch (error) {
- console.log('Auth check failed:', error.message);
+ console.log('โ Auth check failed:', error.message);
}
// List all teams where the commenter is a member
@@ -63,15 +71,15 @@ jobs:
const teams = await github.paginate(github.rest.teams.listForAuthenticatedUser, {});
const userTeams = teams.filter(team => team.organization.login.toLowerCase() === org.toLowerCase());
if (userTeams.length === 0) {
- console.log(`${commenter} is not a member of any team in org ${org}.`);
+ console.log(`โ ๏ธ ${commenter} is not a member of any team in org ${org}.`);
} else {
- console.log(`${commenter} is a member of the following teams in ${org}:`);
+ console.log(`๐ฅ ${commenter} is a member of the following teams in ${org}:`);
userTeams.forEach(team => {
- console.log(`- ${team.slug} (${team.name})`);
+ console.log(` โ ${team.slug} (${team.name})`);
});
}
} catch (err) {
- console.log(`Could not list teams for user ${commenter}: ${err.message}`);
+ console.log(`โ Could not list teams for user ${commenter}: ${err.message}`);
}
}
@@ -79,27 +87,27 @@ jobs:
async function isMemberOfAnyTeam() {
for (const team_slug of team_slugs) {
- console.log(`Checking team_slug: ${team_slug}`);
+ console.log(`๐ Checking team_slug: ${team_slug}`);
try {
const response = await github.rest.teams.getMembershipForUserInOrg({
org,
team_slug,
username: commenter,
});
- console.log(`API response for team_slug ${team_slug}:`, JSON.stringify(response.data, null, 2));
+ console.log(`๐ API response for team_slug ${team_slug}:`, JSON.stringify(response.data, null, 2));
if (response.data.state === 'active') {
- console.log(`${commenter} is an active member of the ${team_slug} team.`);
+ console.log(`โ
${commenter} is an active member of the ${team_slug} team.`);
return true;
}
} catch (error) {
- console.log(`Error object for team_slug ${team_slug}:`, JSON.stringify(error, Object.getOwnPropertyNames(error)));
+ console.log(`โ ๏ธ Error object for team_slug ${team_slug}:`, JSON.stringify(error, Object.getOwnPropertyNames(error)));
if (error.status !== 404) {
- console.log(`Error checking team_slug ${team_slug}: ${error.message}`);
+ console.log(`โ Error checking team_slug ${team_slug}: ${error.message}`);
core.setFailed(`Could not verify team membership for ${team_slug}: ${error.message}`);
return false;
}
// If 404, user is not in this team, continue to next
- console.log(`${commenter} is not a member of ${team_slug} (404)`);
+ console.log(`โน๏ธ ${commenter} is not a member of ${team_slug} (404)`);
}
}
return false;
@@ -108,7 +116,7 @@ jobs:
// Properly await the async function
const isMember = await isMemberOfAnyTeam();
if (!isMember) {
- core.setFailed(`${commenter} is not a member of any required team (${team_slugs.join(', ')})`);
+ core.setFailed(`โ ${commenter} is not a member of any required team (${team_slugs.join(', ')})`);
} else {
console.log(`โ
${commenter} is authorized to trigger builds`);
}
From 0c499f074fd1ed80298444e1beafb971833b1543 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 01:42:53 +0530
Subject: [PATCH 08/43] chore: working so good so far, optimize timestamp diff
logic
---
.../workflows/final-manual-deploy-comment.yml | 32 ++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 328975a33cd..1a6d8107c8b 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -183,8 +183,7 @@ jobs:
TRIGGER_TIME="${{ steps.netlify_build.outputs.trigger_time }}"
SHA="${{ steps.netlify_build.outputs.sha }}"
MAX_WAIT_TIME=1800 # 30 minutes
- POLL_INTERVAL=30 # 30 seconds
- ELAPSED_TIME=0
+ POLL_INTERVAL=90 # 90 seconds for deployment status checks
DEPLOY_ID=""
echo "๐ Starting deployment tracking..."
@@ -192,12 +191,13 @@ jobs:
echo "๐ Commit SHA: $SHA"
echo "โฐ Trigger time: $TRIGGER_TIME"
- # Wait a few seconds for Netlify to create the deployment
- echo "โณ Waiting 10 seconds for Netlify to register the deployment..."
- sleep 10
+ # Wait 30 seconds for Netlify to create the deployment
+ echo "โณ Waiting 30 seconds for Netlify to register the deployment..."
+ sleep 30
# First, find the specific deployment ID that was just triggered
echo "๐ Looking for the deployment triggered by this workflow run..."
+ echo "----------------------------------------"
for i in {1..10}; do
echo "๐ Attempt $i/10 to find deployment..."
@@ -222,6 +222,7 @@ jobs:
echo "โ
Found target deployment!"
echo "๐ Deploy ID: $DEPLOY_ID"
echo "๐
Created at: $CREATED_AT"
+ echo "----------------------------------------"
break
else
echo "โ ๏ธ Found deployment but it's too old (created ${TIME_DIFF}s before trigger)"
@@ -229,8 +230,9 @@ jobs:
fi
if [ $i -lt 10 ]; then
- echo "โณ Deployment not found yet, waiting 5 seconds..."
- sleep 5
+ echo "โณ Deployment not found yet, waiting 15 seconds..."
+ echo "----------------------------------------"
+ sleep 15
fi
done
@@ -250,7 +252,9 @@ jobs:
ELAPSED_TIME=0
while [ $ELAPSED_TIME -lt $MAX_WAIT_TIME ]; do
- echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${ELAPSED_TIME}s / ${MAX_WAIT_TIME}s)"
+ MINUTES_ELAPSED=$(awk "BEGIN {print $ELAPSED_TIME/60}")
+ echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${MINUTES_ELAPSED}/30 minutes)"
+ echo "----------------------------------------"
if [ "$USE_FALLBACK" = "true" ]; then
# Fallback: Get latest deployment for branch
@@ -321,9 +325,9 @@ jobs:
Your preview deployment has completed successfully and is now live!
๐ **Preview URL:** [${{ steps.poll_netlify.outputs.deploy_url }}](${{ steps.poll_netlify.outputs.deploy_url }})
-
- ๐ฆ **Deploy ID:** `${{ steps.poll_netlify.outputs.deploy_id }}`
-
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+
The preview is ready for review. Please test your changes thoroughly before merging.
comment_tag: manual-build-comment
@@ -348,6 +352,9 @@ jobs:
${{ steps.poll_netlify.outputs.error_message }}
```
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+
### ๐ ๏ธ Required Actions:
1. **Review the error message above carefully**
@@ -382,6 +389,9 @@ jobs:
- Netlify is experiencing delays
- The build queue is backed up
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+
**Next steps:**
1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status
2. Look for branch: `${{ steps.netlify_build.outputs.branch_name }}`
From 6608308697b6148e056129666d4c30233ceefcb3 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 02:07:28 +0530
Subject: [PATCH 09/43] chore: works as expected, some cosmetic changes
---
.github/workflows/final-manual-deploy-comment.yml | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 1a6d8107c8b..de3bb8d6b96 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -170,7 +170,8 @@ jobs:
Build triggered for PR #${{ steps.netlify_build.outputs.pr_number }} (commit: `${{ steps.netlify_build.outputs.sha }}`)
โณ Monitoring deployment status... This usually takes 10-20 minutes.
- comment_tag: manual-build-comment
+ # Removed `comment_tag` to ensure a new comment is added every time
+ # comment_tag: manual-build-comment
# Poll Netlify API to check deployment status
- name: Poll Netlify deployment status
@@ -213,6 +214,7 @@ jobs:
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
+ DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
# Check if deployment was created after (or very close to) our trigger time
@@ -221,6 +223,7 @@ jobs:
if [ $TIME_DIFF -ge -5 ]; then
echo "โ
Found target deployment!"
echo "๐ Deploy ID: $DEPLOY_ID"
+ echo "๐ Netlify Deployment URL: $DEPLOY_URL"
echo "๐
Created at: $CREATED_AT"
echo "----------------------------------------"
break
@@ -285,13 +288,14 @@ jobs:
if [ "$STATE" = "ready" ]; then
echo "โ
Deployment successful!"
- echo "๐ URL: $DEPLOY_URL"
+ echo "๐ Netlify Deployment URL: $DEPLOY_URL"
echo "status=success" >> $GITHUB_OUTPUT
echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "error" ]; then
echo "โ Deployment failed!"
+ echo "๐ Netlify Deployment URL: $DEPLOY_URL"
echo "๐ฅ Error: $ERROR_MESSAGE"
echo "status=failure" >> $GITHUB_OUTPUT
echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
@@ -299,6 +303,7 @@ jobs:
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
echo "โณ Deployment in progress (state: $STATE)..."
+ echo "๐ Netlify Deployment URL: $DEPLOY_URL"
else
echo "โ ๏ธ Unknown state: $STATE"
fi
@@ -312,6 +317,7 @@ jobs:
echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
+ echo "๐ Netlify Deployment URL: $DEPLOY_URL"
echo "status=timeout" >> $GITHUB_OUTPUT
# Post success comment
@@ -329,7 +335,6 @@ jobs:
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The preview is ready for review. Please test your changes thoroughly before merging.
- comment_tag: manual-build-comment
# Post failure comment
- name: Post failure comment
@@ -372,7 +377,6 @@ jobs:
---
**๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**
- comment_tag: manual-build-comment
# Post timeout comment
- name: Post timeout comment
@@ -400,7 +404,7 @@ jobs:
**Expected preview URL (once ready):**
https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app
- comment_tag: manual-build-comment
+
# Fail the workflow if deployment failed
- name: Fail workflow on deployment failure
From a2f5c11544b5fd6014c5e35293f64544c0a6a716 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 02:18:20 +0530
Subject: [PATCH 10/43] chore: works as expected, some cosmetic changes,
probably final?
---
.../workflows/final-manual-deploy-comment.yml | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index de3bb8d6b96..1115b4ad3de 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -214,16 +214,18 @@ jobs:
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
- DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
+ # Construct the Netlify Build URL
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+
# Check if deployment was created after (or very close to) our trigger time
TIME_DIFF=$((CREATED_TIMESTAMP - TRIGGER_TIME))
if [ $TIME_DIFF -ge -5 ]; then
echo "โ
Found target deployment!"
echo "๐ Deploy ID: $DEPLOY_ID"
- echo "๐ Netlify Deployment URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
echo "๐
Created at: $CREATED_AT"
echo "----------------------------------------"
break
@@ -278,6 +280,9 @@ jobs:
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
+ # Construct the Netlify Build URL
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+
# Update DEPLOY_ID if we were using fallback
if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
DEPLOY_ID=$CURRENT_DEPLOY_ID
@@ -288,14 +293,14 @@ jobs:
if [ "$STATE" = "ready" ]; then
echo "โ
Deployment successful!"
- echo "๐ Netlify Deployment URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
echo "status=success" >> $GITHUB_OUTPUT
- echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
+ echo "deploy_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "error" ]; then
echo "โ Deployment failed!"
- echo "๐ Netlify Deployment URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
echo "๐ฅ Error: $ERROR_MESSAGE"
echo "status=failure" >> $GITHUB_OUTPUT
echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
@@ -303,7 +308,7 @@ jobs:
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
echo "โณ Deployment in progress (state: $STATE)..."
- echo "๐ Netlify Deployment URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
else
echo "โ ๏ธ Unknown state: $STATE"
fi
@@ -317,7 +322,7 @@ jobs:
echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
- echo "๐ Netlify Deployment URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
echo "status=timeout" >> $GITHUB_OUTPUT
# Post success comment
From b13e0f18e79ae7ccfad1983d174c82fd2001826e Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 23:11:06 +0530
Subject: [PATCH 11/43] chore: remove the build failure inducer to test success
flow
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index f1740a9aff5..e48c12e63cc 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-31'
+releaseDate: '2025-06-30'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From b804bdf325984c918e6abd3812410b1243ccaea3 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 23:49:09 +0530
Subject: [PATCH 12/43] chore: more cosmetics, timezone changes, informative PR
comments
---
.../workflows/final-manual-deploy-comment.yml | 103 ++++++++++++++----
1 file changed, 79 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 1115b4ad3de..403551322e2 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -183,15 +183,18 @@ jobs:
BRANCH_NAME="${{ steps.netlify_build.outputs.branch_name }}"
TRIGGER_TIME="${{ steps.netlify_build.outputs.trigger_time }}"
SHA="${{ steps.netlify_build.outputs.sha }}"
+ PR_NUMBER="${{ steps.netlify_build.outputs.pr_number }}"
MAX_WAIT_TIME=1800 # 30 minutes
POLL_INTERVAL=90 # 90 seconds for deployment status checks
DEPLOY_ID=""
+ DEPLOY_FOUND_VIA=""
echo "๐ Starting deployment tracking..."
echo "๐ Branch: $BRANCH_NAME"
echo "๐ Commit SHA: $SHA"
- echo "โฐ Trigger time: $TRIGGER_TIME"
-
+ echo "โฐ Trigger time (UTC): $TRIGGER_TIME"
+ echo "โฐ Trigger time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME)"
+
# Wait 30 seconds for Netlify to create the deployment
echo "โณ Waiting 30 seconds for Netlify to register the deployment..."
sleep 30
@@ -200,7 +203,7 @@ jobs:
echo "๐ Looking for the deployment triggered by this workflow run..."
echo "----------------------------------------"
for i in {1..10}; do
- echo "๐ Attempt $i/10 to find deployment..."
+ echo "๐ Attempt $i/10 to find deployment at $(TZ=Asia/Kolkata date)"
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
@@ -226,8 +229,10 @@ jobs:
echo "โ
Found target deployment!"
echo "๐ Deploy ID: $DEPLOY_ID"
echo "๐ Netlify Build URL: $BUILD_URL"
- echo "๐
Created at: $CREATED_AT"
+ echo "๐
Created at (UTC): $CREATED_AT"
+ echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)"
echo "----------------------------------------"
+ DEPLOY_FOUND_VIA="commit"
break
else
echo "โ ๏ธ Found deployment but it's too old (created ${TIME_DIFF}s before trigger)"
@@ -245,22 +250,75 @@ jobs:
echo "โ Could not find deployment after 10 attempts"
echo "๐ Falling back to branch-based tracking..."
# Fallback: track by branch name only
- USE_FALLBACK=true
- else
- echo "๐ฏ Locked onto deployment ID: $DEPLOY_ID"
- USE_FALLBACK=false
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+
+ if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
+ DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
+ CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
+ CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+ echo "โ
Found deployment via branch-based validation!"
+ echo "๐ Deploy ID: $DEPLOY_ID"
+ echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐
Created at (UTC): $CREATED_AT"
+ echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)"
+ echo "----------------------------------------"
+ DEPLOY_FOUND_VIA="branch"
+ else
+ echo "โ No deployment found for branch-based validation either."
+ exit 1
+ fi
fi
-
- # Now poll the specific deployment until completion
- echo ""
- echo "๐ Starting status monitoring..."
+
+ # Update the PR comment with deployment details
+ echo "๐ Updating PR comment with deployment details..."
+ if [ "$DEPLOY_FOUND_VIA" = "commit" ]; then
+ COMMENT_MESSAGE="### ๐ Netlify Deployment In Progress\n\n"
+ COMMENT_MESSAGE+="The deployment was found via **commit-based validation**.\n\n"
+ COMMENT_MESSAGE+="- **Commit SHA:** \`$SHA\`\n"
+ COMMENT_MESSAGE+="- **Netlify Build URL:** [View Deployment]($BUILD_URL)\n"
+ COMMENT_MESSAGE+="- **Deployment Created At (IST):** $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)\n"
+ elif [ "$DEPLOY_FOUND_VIA" = "branch" ]; then
+ COMMENT_MESSAGE="### ๐ Netlify Deployment In Progress\n\n"
+ COMMENT_MESSAGE+="The deployment was found via **branch-based validation**.\n\n"
+ COMMENT_MESSAGE+="- **Branch Name:** \`$BRANCH_NAME\`\n"
+ COMMENT_MESSAGE+="- **Netlify Build URL:** [View Deployment]($BUILD_URL)\n"
+ COMMENT_MESSAGE+="- **Deployment Created At (IST):** $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)\n"
+ fi
+
+ echo "$COMMENT_MESSAGE" > comment_body.txt
+
+ gh pr comment $PR_NUMBER --body-file comment_body.txt
+
+ # This step checks the status of the deployment and reports back to the PR
+ - name: Check deployment status and report
+ id: check_status
+ env:
+ NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+ run: |
+ DEPLOY_ID="${{ steps.poll_netlify.outputs.deploy_id }}"
+ BRANCH_NAME="${{ steps.netlify_build.outputs.branch_name }}"
+ SHA="${{ steps.netlify_build.outputs.sha }}"
+ PR_NUMBER="${{ steps.netlify_build.outputs.pr_number }}"
+ MAX_WAIT_TIME=1800 # 30 minutes
+ POLL_INTERVAL=90 # 90 seconds for deployment status checks
ELAPSED_TIME=0
+ USE_FALLBACK=false
+
+ echo "๐ Starting deployment status check..."
+ echo "๐ Deploy ID: $DEPLOY_ID"
+ echo "๐ Branch: $BRANCH_NAME"
+ echo "๐
Triggered at (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }})"
+
+ # If no deploy ID found, fallback to branch name
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+ echo "โ ๏ธ No Deploy ID found. Falling back to branch-based tracking..."
+ USE_FALLBACK=true
+ fi
while [ $ELAPSED_TIME -lt $MAX_WAIT_TIME ]; do
- MINUTES_ELAPSED=$(awk "BEGIN {print $ELAPSED_TIME/60}")
- echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${MINUTES_ELAPSED}/30 minutes)"
- echo "----------------------------------------"
-
if [ "$USE_FALLBACK" = "true" ]; then
# Fallback: Get latest deployment for branch
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
@@ -280,9 +338,6 @@ jobs:
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
- # Construct the Netlify Build URL
- BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
-
# Update DEPLOY_ID if we were using fallback
if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
DEPLOY_ID=$CURRENT_DEPLOY_ID
@@ -293,14 +348,14 @@ jobs:
if [ "$STATE" = "ready" ]; then
echo "โ
Deployment successful!"
- echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐ Netlify Build URL: $DEPLOY_URL"
echo "status=success" >> $GITHUB_OUTPUT
- echo "deploy_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "error" ]; then
echo "โ Deployment failed!"
- echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐ Netlify Build URL: $DEPLOY_URL"
echo "๐ฅ Error: $ERROR_MESSAGE"
echo "status=failure" >> $GITHUB_OUTPUT
echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
@@ -308,7 +363,7 @@ jobs:
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
echo "โณ Deployment in progress (state: $STATE)..."
- echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐ Netlify Build URL: $DEPLOY_URL"
else
echo "โ ๏ธ Unknown state: $STATE"
fi
@@ -322,7 +377,7 @@ jobs:
echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
- echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐ Netlify Build URL: $DEPLOY_URL"
echo "status=timeout" >> $GITHUB_OUTPUT
# Post success comment
From 0c3b9ad3325c53ab056e2132005c3f6bc64bd77c Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sat, 8 Nov 2025 23:56:27 +0530
Subject: [PATCH 13/43] chore: tiny fixes
---
.github/workflows/final-manual-deploy-comment.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 403551322e2..160a96794e7 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -179,6 +179,7 @@ jobs:
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="${{ steps.netlify_build.outputs.branch_name }}"
TRIGGER_TIME="${{ steps.netlify_build.outputs.trigger_time }}"
@@ -193,7 +194,7 @@ jobs:
echo "๐ Branch: $BRANCH_NAME"
echo "๐ Commit SHA: $SHA"
echo "โฐ Trigger time (UTC): $TRIGGER_TIME"
- echo "โฐ Trigger time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME)"
+ echo "โฐ Trigger time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S IST')"
# Wait 30 seconds for Netlify to create the deployment
echo "โณ Waiting 30 seconds for Netlify to register the deployment..."
From a34999533c61107d549d1ebb32c09aa7ef266463 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 00:05:53 +0530
Subject: [PATCH 14/43] chore: tiny fixes
---
.../workflows/final-manual-deploy-comment.yml | 92 +++++++++++--------
1 file changed, 55 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 160a96794e7..228b61ef796 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -16,8 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- # New step to check if the PR is from a forked repository.
- # If the PR is from a fork, doesn't run. Only runs for branches in the main repo.
+ # New step to check if the PR is from a fork
- name: Check if PR is from a fork
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -231,9 +230,15 @@ jobs:
echo "๐ Deploy ID: $DEPLOY_ID"
echo "๐ Netlify Build URL: $BUILD_URL"
echo "๐
Created at (UTC): $CREATED_AT"
- echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)"
+ echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')"
echo "----------------------------------------"
DEPLOY_FOUND_VIA="commit"
+
+ # Export values for use in the next step
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
+ echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
break
else
echo "โ ๏ธ Found deployment but it's too old (created ${TIME_DIFF}s before trigger)"
@@ -263,34 +268,37 @@ jobs:
echo "๐ Deploy ID: $DEPLOY_ID"
echo "๐ Netlify Build URL: $BUILD_URL"
echo "๐
Created at (UTC): $CREATED_AT"
- echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)"
+ echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')"
echo "----------------------------------------"
DEPLOY_FOUND_VIA="branch"
+
+ # Export values for use in the next step
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
+ echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
else
echo "โ No deployment found for branch-based validation either."
exit 1
fi
fi
- # Update the PR comment with deployment details
- echo "๐ Updating PR comment with deployment details..."
- if [ "$DEPLOY_FOUND_VIA" = "commit" ]; then
- COMMENT_MESSAGE="### ๐ Netlify Deployment In Progress\n\n"
- COMMENT_MESSAGE+="The deployment was found via **commit-based validation**.\n\n"
- COMMENT_MESSAGE+="- **Commit SHA:** \`$SHA\`\n"
- COMMENT_MESSAGE+="- **Netlify Build URL:** [View Deployment]($BUILD_URL)\n"
- COMMENT_MESSAGE+="- **Deployment Created At (IST):** $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)\n"
- elif [ "$DEPLOY_FOUND_VIA" = "branch" ]; then
- COMMENT_MESSAGE="### ๐ Netlify Deployment In Progress\n\n"
- COMMENT_MESSAGE+="The deployment was found via **branch-based validation**.\n\n"
- COMMENT_MESSAGE+="- **Branch Name:** \`$BRANCH_NAME\`\n"
- COMMENT_MESSAGE+="- **Netlify Build URL:** [View Deployment]($BUILD_URL)\n"
- COMMENT_MESSAGE+="- **Deployment Created At (IST):** $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP)\n"
- fi
+ # Update PR comment with deployment details
+ - name: Update PR comment with deployment details
+ if: steps.poll_netlify.outputs.deploy_id != ''
+ uses: thollander/actions-comment-pull-request@v2
+ with:
+ message: |
+ ### ๐ Netlify Deployment In Progress
+
+ The deployment was found via **${{ steps.poll_netlify.outputs.deploy_found_via }}-based validation**.
- echo "$COMMENT_MESSAGE" > comment_body.txt
+ ${{ steps.poll_netlify.outputs.deploy_found_via == 'commit' && format('- **Commit SHA:** `{0}`', steps.netlify_build.outputs.sha) || format('- **Branch Name:** `{0}`', steps.netlify_build.outputs.branch_name) }}
+ - **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
+ - **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}
- gh pr comment $PR_NUMBER --body-file comment_body.txt
+ โณ Build is currently in progress. Monitoring status...
+ comment_tag: manual-build-comment
# This step checks the status of the deployment and reports back to the PR
- name: Check deployment status and report
@@ -311,7 +319,7 @@ jobs:
echo "๐ Starting deployment status check..."
echo "๐ Deploy ID: $DEPLOY_ID"
echo "๐ Branch: $BRANCH_NAME"
- echo "๐
Triggered at (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }})"
+ echo "๐
Triggered at (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S IST')"
# If no deploy ID found, fallback to branch name
if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
@@ -320,6 +328,10 @@ jobs:
fi
while [ $ELAPSED_TIME -lt $MAX_WAIT_TIME ]; do
+ MINUTES_ELAPSED=$(awk "BEGIN {print $ELAPSED_TIME/60}")
+ echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${MINUTES_ELAPSED}/30 minutes) at $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S IST')"
+ echo "----------------------------------------"
+
if [ "$USE_FALLBACK" = "true" ]; then
# Fallback: Get latest deployment for branch
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
@@ -339,6 +351,9 @@ jobs:
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
+ # Construct the Netlify Build URL
+ BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
+
# Update DEPLOY_ID if we were using fallback
if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
DEPLOY_ID=$CURRENT_DEPLOY_ID
@@ -349,14 +364,15 @@ jobs:
if [ "$STATE" = "ready" ]; then
echo "โ
Deployment successful!"
- echo "๐ Netlify Build URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
+ echo "๐ Deploy URL: $DEPLOY_URL"
echo "status=success" >> $GITHUB_OUTPUT
echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "error" ]; then
echo "โ Deployment failed!"
- echo "๐ Netlify Build URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
echo "๐ฅ Error: $ERROR_MESSAGE"
echo "status=failure" >> $GITHUB_OUTPUT
echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
@@ -364,7 +380,7 @@ jobs:
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
echo "โณ Deployment in progress (state: $STATE)..."
- echo "๐ Netlify Build URL: $DEPLOY_URL"
+ echo "๐ Netlify Build URL: $BUILD_URL"
else
echo "โ ๏ธ Unknown state: $STATE"
fi
@@ -378,12 +394,12 @@ jobs:
echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
- echo "๐ Netlify Build URL: $DEPLOY_URL"
echo "status=timeout" >> $GITHUB_OUTPUT
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
# Post success comment
- name: Post success comment
- if: steps.poll_netlify.outputs.status == 'success'
+ if: steps.check_status.outputs.status == 'success'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
@@ -391,15 +407,16 @@ jobs:
Your preview deployment has completed successfully and is now live!
- ๐ **Preview URL:** [${{ steps.poll_netlify.outputs.deploy_url }}](${{ steps.poll_netlify.outputs.deploy_url }})
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The preview is ready for review. Please test your changes thoroughly before merging.
+ comment_tag: manual-build-comment
# Post failure comment
- name: Post failure comment
- if: steps.poll_netlify.outputs.status == 'failure'
+ if: steps.check_status.outputs.status == 'failure'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
@@ -412,13 +429,13 @@ jobs:
### ๐ด Critical Issue Details:
- **Status:** Build Failed
- - **Deploy ID:** `${{ steps.poll_netlify.outputs.deploy_id }}`
+ - **Deploy ID:** `${{ steps.check_status.outputs.deploy_id }}`
- **Error Message:**
```
- ${{ steps.poll_netlify.outputs.error_message }}
+ ${{ steps.check_status.outputs.error_message }}
```
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
### ๐ ๏ธ Required Actions:
@@ -438,10 +455,11 @@ jobs:
---
**๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**
+ comment_tag: manual-build-comment
# Post timeout comment
- name: Post timeout comment
- if: steps.poll_netlify.outputs.status == 'timeout'
+ if: steps.check_status.outputs.status == 'timeout'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
@@ -454,7 +472,7 @@ jobs:
- Netlify is experiencing delays
- The build queue is backed up
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.poll_netlify.outputs.deploy_id }})
+ ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
**Next steps:**
@@ -465,11 +483,11 @@ jobs:
**Expected preview URL (once ready):**
https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app
-
+ comment_tag: manual-build-comment
# Fail the workflow if deployment failed
- name: Fail workflow on deployment failure
- if: steps.poll_netlify.outputs.status == 'failure'
+ if: steps.check_status.outputs.status == 'failure'
run: |
echo "::error::Netlify deployment failed. This PR should not be merged."
exit 1
\ No newline at end of file
From 178dac12ae8daa55a02a0efca75d943975bfcb67 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 00:26:49 +0530
Subject: [PATCH 15/43] chore: hopefully cosmetic changes should work now?
---
.../workflows/final-manual-deploy-comment.yml | 406 ++++++++++++------
1 file changed, 277 insertions(+), 129 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 228b61ef796..ccc48fda58a 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -16,22 +16,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- # New step to check if the PR is from a fork
- - name: Check if PR is from a fork
+ - name: ๐ Verify Repository Source
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ Checking if PR is from a forked repository..."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
PR_URL="${{ github.event.issue.pull_request.url }}"
IS_FORK=$(gh api "$PR_URL" --jq '.head.repo.fork')
if [[ "$IS_FORK" == "true" ]]; then
- echo "๐ Halting: This workflow only runs for branches in the main repository, not for forks."
+ echo ""
+ echo "๐ HALTING WORKFLOW"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "This workflow only runs for branches in the main repository."
+ echo "Forks are not supported for security reasons."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
exit 1
else
- echo "โ
PR is not from a fork. Proceeding with the job."
+ echo ""
+ echo "โ
Repository source verified"
+ echo "๐ Source: Main repository (not a fork)"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
fi
- - name: Check for member permission
+ - name: ๐ Validate Team Membership
# Only run this check for issue_comment events (manual triggers)
# For pull_request events, the PR author is implicitly authorized
@@ -120,15 +131,18 @@ jobs:
console.log(`โ
${commenter} is authorized to trigger builds`);
}
- # we use `jq` to parse the GH API response
- - name: setup jq
+ - name: ๐ ๏ธ Initialize Dependencies
uses: dcarbone/install-jq-action@v2
- - name: send request to Netlify build hook
+ - name: ๐ Trigger Netlify Deployment
id: netlify_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ NETLIFY DEPLOYMENT TRIGGER"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com//')
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
@@ -139,19 +153,27 @@ jobs:
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
echo "sha=$sha" >> $GITHUB_OUTPUT
- # Capture the timestamp before triggering the build
TRIGGER_TIME=$(date -u +%s)
echo "trigger_time=$TRIGGER_TIME" >> $GITHUB_OUTPUT
- echo "๐ Triggering Netlify build for branch: $branch_name"
- echo "๐ PR #$pr_number | Commit: $sha"
-
+ echo ""
+ echo "๐ Deployment Details:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Branch: $branch_name"
+ echo " ๐ข PR #: $pr_number"
+ echo " ๐ Commit: $sha"
+ echo " ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ echo ""
+ echo "๐ Sending build request to Netlify..."
curl -X POST \
"https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK_ID }}?trigger_branch=$branch_name"'&trigger_title=Manual+deploy+preview+for+PR+%23'"$pr_number"'+-+'"$sha"
+ echo ""
echo "โ
Build hook triggered successfully"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- # This step gets the branch name and replaces any non-alpha-numeric characters with '-' to match Netlify's URL format and capital letters to small case
- name: Sanitize branch name for Netlify URL
id: sanitize_branch
run: |
@@ -159,21 +181,33 @@ jobs:
SANITIZED_BRANCH_NAME=$(echo "${{ steps.netlify_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- # This step now posts a comment with the dynamically constructed preview URL.
- - name: Add PR comment with preview URL
- uses: thollander/actions-comment-pull-request@v2
+ - name: ๐ Create PR Status Comment
+ id: initial_comment
+ uses: actions/github-script@v7
with:
- message: |
- ### ๐ Netlify Preview Building!
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('๐ Creating initial PR comment...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const { data: comment } = await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: ${{ steps.netlify_build.outputs.pr_number }},
+ body: `### ๐ Netlify Preview Building!
- Build triggered for PR #${{ steps.netlify_build.outputs.pr_number }} (commit: `${{ steps.netlify_build.outputs.sha }}`)
+ Build triggered for PR #${{ steps.netlify_build.outputs.pr_number }} (commit: \`${{ steps.netlify_build.outputs.sha }}\`)
+
+ โณ Monitoring deployment status... This usually takes 10-20 minutes.`
+ });
- โณ Monitoring deployment status... This usually takes 10-20 minutes.
- # Removed `comment_tag` to ensure a new comment is added every time
- # comment_tag: manual-build-comment
+ console.log('โ
Comment created successfully');
+ console.log('๐ Comment ID:', comment.id);
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ core.setOutput('comment_id', comment.id);
- # Poll Netlify API to check deployment status
- - name: Poll Netlify deployment status
+ - name: ๐ Locate Netlify Deployment
id: poll_netlify
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -184,32 +218,40 @@ jobs:
TRIGGER_TIME="${{ steps.netlify_build.outputs.trigger_time }}"
SHA="${{ steps.netlify_build.outputs.sha }}"
PR_NUMBER="${{ steps.netlify_build.outputs.pr_number }}"
- MAX_WAIT_TIME=1800 # 30 minutes
- POLL_INTERVAL=90 # 90 seconds for deployment status checks
DEPLOY_ID=""
DEPLOY_FOUND_VIA=""
- echo "๐ Starting deployment tracking..."
- echo "๐ Branch: $BRANCH_NAME"
- echo "๐ Commit SHA: $SHA"
- echo "โฐ Trigger time (UTC): $TRIGGER_TIME"
- echo "โฐ Trigger time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S IST')"
-
- # Wait 30 seconds for Netlify to create the deployment
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ DEPLOYMENT DISCOVERY PROCESS"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ Search Parameters:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Branch: $BRANCH_NAME"
+ echo " ๐ Commit SHA: $SHA"
+ echo " ๐ Trigger (UTC): $(date -u -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S')"
+ echo " ๐ Trigger (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S')"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ echo ""
echo "โณ Waiting 30 seconds for Netlify to register the deployment..."
sleep 30
- # First, find the specific deployment ID that was just triggered
- echo "๐ Looking for the deployment triggered by this workflow run..."
- echo "----------------------------------------"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ SEARCHING FOR DEPLOYMENT (COMMIT-BASED) โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
for i in {1..10}; do
- echo "๐ Attempt $i/10 to find deployment at $(TZ=Asia/Kolkata date)"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ ๐ Attempt $i/10 "
+ echo "โ ๐ Time: $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S IST') "
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
- # Find deployment matching our branch and created after trigger time
- # We look for deployments with our exact commit SHA for precision
DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" --arg sha "$SHA" \
'[.[] | select(.branch == $branch and (.commit_ref == $sha or .head == $sha))] |
sort_by(.created_at) | reverse | .[0]')
@@ -219,43 +261,47 @@ jobs:
CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
- # Construct the Netlify Build URL
BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
- # Check if deployment was created after (or very close to) our trigger time
TIME_DIFF=$((CREATED_TIMESTAMP - TRIGGER_TIME))
if [ $TIME_DIFF -ge -5 ]; then
- echo "โ
Found target deployment!"
- echo "๐ Deploy ID: $DEPLOY_ID"
- echo "๐ Netlify Build URL: $BUILD_URL"
- echo "๐
Created at (UTC): $CREATED_AT"
- echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')"
- echo "----------------------------------------"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ
DEPLOYMENT FOUND! โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ฆ Deployment Information:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐
Created (UTC): $CREATED_AT"
+ echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
+ echo " โ
Method: Commit-based validation"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
DEPLOY_FOUND_VIA="commit"
- # Export values for use in the next step
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
break
else
- echo "โ ๏ธ Found deployment but it's too old (created ${TIME_DIFF}s before trigger)"
+ echo " โ ๏ธ Found deployment but it's too old (${TIME_DIFF}s offset)"
fi
fi
if [ $i -lt 10 ]; then
- echo "โณ Deployment not found yet, waiting 15 seconds..."
- echo "----------------------------------------"
- sleep 15
+ echo " โณ Not found yet, waiting 15 seconds..."
fi
done
if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
- echo "โ Could not find deployment after 10 attempts"
- echo "๐ Falling back to branch-based tracking..."
- # Fallback: track by branch name only
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ FALLBACK: SEARCHING BY BRANCH NAME โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
'[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
@@ -264,32 +310,49 @@ jobs:
CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
- echo "โ
Found deployment via branch-based validation!"
- echo "๐ Deploy ID: $DEPLOY_ID"
- echo "๐ Netlify Build URL: $BUILD_URL"
- echo "๐
Created at (UTC): $CREATED_AT"
- echo "๐
Created at (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')"
- echo "----------------------------------------"
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ
DEPLOYMENT FOUND (BRANCH-BASED) โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ฆ Deployment Information:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐
Created (UTC): $CREATED_AT"
+ echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
+ echo " โ ๏ธ Method: Branch-based validation (fallback)"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
DEPLOY_FOUND_VIA="branch"
- # Export values for use in the next step
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
else
- echo "โ No deployment found for branch-based validation either."
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ DEPLOYMENT NOT FOUND โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "No deployment could be located using either method."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
exit 1
fi
fi
- # Update PR comment with deployment details
- - name: Update PR comment with deployment details
+ - name: ๐ Update PR Comment (Deployment Found)
if: steps.poll_netlify.outputs.deploy_id != ''
- uses: thollander/actions-comment-pull-request@v2
+ uses: actions/github-script@v7
with:
- message: |
- ### ๐ Netlify Deployment In Progress
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('๐ Updating PR comment with deployment details...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentBody = `### ๐ Netlify Deployment In Progress
The deployment was found via **${{ steps.poll_netlify.outputs.deploy_found_via }}-based validation**.
@@ -297,11 +360,19 @@ jobs:
- **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
- **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}
- โณ Build is currently in progress. Monitoring status...
- comment_tag: manual-build-comment
+ โณ Build is currently in progress. Monitoring status...`;
+
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: ${{ steps.initial_comment.outputs.comment_id }},
+ body: commentBody
+ });
+
+ console.log('โ
PR comment updated successfully');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- # This step checks the status of the deployment and reports back to the PR
- - name: Check deployment status and report
+ - name: ๐ Monitor Deployment Status
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -311,36 +382,52 @@ jobs:
BRANCH_NAME="${{ steps.netlify_build.outputs.branch_name }}"
SHA="${{ steps.netlify_build.outputs.sha }}"
PR_NUMBER="${{ steps.netlify_build.outputs.pr_number }}"
- MAX_WAIT_TIME=1800 # 30 minutes
- POLL_INTERVAL=90 # 90 seconds for deployment status checks
+ MAX_WAIT_TIME=1800
+ POLL_INTERVAL=90
ELAPSED_TIME=0
USE_FALLBACK=false
- echo "๐ Starting deployment status check..."
- echo "๐ Deploy ID: $DEPLOY_ID"
- echo "๐ Branch: $BRANCH_NAME"
- echo "๐
Triggered at (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S IST')"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ DEPLOYMENT STATUS MONITORING"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ Monitoring Configuration:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Branch: $BRANCH_NAME"
+ echo " โฑ๏ธ Max Wait Time: 30 minutes"
+ echo " ๐ Poll Interval: 90 seconds"
+ echo " ๐ Started (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S')"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- # If no deploy ID found, fallback to branch name
if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
- echo "โ ๏ธ No Deploy ID found. Falling back to branch-based tracking..."
+ echo ""
+ echo "โ ๏ธ WARNING: No Deploy ID found. Using branch-based fallback."
USE_FALLBACK=true
fi
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ POLLING DEPLOYMENT STATUS โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
while [ $ELAPSED_TIME -lt $MAX_WAIT_TIME ]; do
- MINUTES_ELAPSED=$(awk "BEGIN {print $ELAPSED_TIME/60}")
- echo "๐ Checking deployment status... (โฑ๏ธ elapsed: ${MINUTES_ELAPSED}/30 minutes) at $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S IST')"
- echo "----------------------------------------"
+ MINUTES_ELAPSED=$(awk "BEGIN {printf \"%.1f\", $ELAPSED_TIME/60}")
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ ๐ Status Check "
+ echo "โ โฑ๏ธ Elapsed: ${MINUTES_ELAPSED}/30.0 minutes "
+ echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S') "
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
if [ "$USE_FALLBACK" = "true" ]; then
- # Fallback: Get latest deployment for branch
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
'[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
else
- # Primary: Get specific deployment by ID
DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
fi
@@ -351,59 +438,86 @@ jobs:
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
- # Construct the Netlify Build URL
BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
- # Update DEPLOY_ID if we were using fallback
if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
DEPLOY_ID=$CURRENT_DEPLOY_ID
- echo "๐ Deployment ID: $DEPLOY_ID"
+ echo " ๐ Deployment ID: $DEPLOY_ID"
fi
- echo "๐ Current state: $STATE"
+ echo " ๐ Current State: $STATE"
if [ "$STATE" = "ready" ]; then
- echo "โ
Deployment successful!"
- echo "๐ Netlify Build URL: $BUILD_URL"
- echo "๐ Deploy URL: $DEPLOY_URL"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ
DEPLOYMENT SUCCESSFUL! โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ Deployment Details:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Preview URL: $DEPLOY_URL"
+ echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
echo "status=success" >> $GITHUB_OUTPUT
echo "deploy_url=$DEPLOY_URL" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "error" ]; then
- echo "โ Deployment failed!"
- echo "๐ Netlify Build URL: $BUILD_URL"
- echo "๐ฅ Error: $ERROR_MESSAGE"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ DEPLOYMENT FAILED โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ฅ Error Details:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Error: $ERROR_MESSAGE"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
echo "status=failure" >> $GITHUB_OUTPUT
echo "error_message=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
- echo "โณ Deployment in progress (state: $STATE)..."
- echo "๐ Netlify Build URL: $BUILD_URL"
+ echo " โณ Status: In Progress ($STATE)"
+ echo " ๐ Build: $BUILD_URL"
else
- echo "โ ๏ธ Unknown state: $STATE"
+ echo " โ ๏ธ Status: Unknown ($STATE)"
fi
else
- echo "โ No deployment data returned from Netlify API"
+ echo " โ No data returned from Netlify API"
fi
sleep $POLL_INTERVAL
ELAPSED_TIME=$((ELAPSED_TIME + POLL_INTERVAL))
done
- echo "โฑ๏ธ Timeout reached after ${MAX_WAIT_TIME}s"
- echo "โ ๏ธ Build is still running or Netlify is experiencing delays"
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โฑ๏ธ TIMEOUT REACHED โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "โ ๏ธ The deployment is taking longer than 30 minutes."
+ echo "Please check the Netlify dashboard for status updates."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
echo "status=timeout" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- # Post success comment
- - name: Post success comment
+ - name: โ
Update PR Comment (Success)
if: steps.check_status.outputs.status == 'success'
- uses: thollander/actions-comment-pull-request@v2
+ uses: actions/github-script@v7
with:
- message: |
- ### โ
Netlify Preview Deploy Successful!
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ
Updating PR comment with success status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentBody = `### โ
Netlify Preview Deploy Successful!
Your preview deployment has completed successfully and is now live!
@@ -411,16 +525,29 @@ jobs:
๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
- The preview is ready for review. Please test your changes thoroughly before merging.
- comment_tag: manual-build-comment
+ The preview is ready for review. Please test your changes thoroughly before merging.`;
+
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: ${{ steps.initial_comment.outputs.comment_id }},
+ body: commentBody
+ });
+
+ console.log('โ
Success comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- # Post failure comment
- - name: Post failure comment
+ - name: โ Update PR Comment (Failure)
if: steps.check_status.outputs.status == 'failure'
- uses: thollander/actions-comment-pull-request@v2
+ uses: actions/github-script@v7
with:
- message: |
- # ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ Updating PR comment with failure status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentBody = `# ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ
## โ **DO NOT MERGE THIS PR** โ
@@ -429,11 +556,11 @@ jobs:
### ๐ด Critical Issue Details:
- **Status:** Build Failed
- - **Deploy ID:** `${{ steps.check_status.outputs.deploy_id }}`
+ - **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Error Message:**
- ```
+ \`\`\`
${{ steps.check_status.outputs.error_message }}
- ```
+ \`\`\`
๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
@@ -443,7 +570,7 @@ jobs:
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**
+ 4. **Trigger a new build with \`netlify build\` comment once fixed**
### โ ๏ธ WARNING TO MAINTAINERS:
@@ -454,16 +581,29 @@ jobs:
---
- **๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**
- comment_tag: manual-build-comment
+ **๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**`;
+
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: ${{ steps.initial_comment.outputs.comment_id }},
+ body: commentBody
+ });
+
+ console.log('โ Failure comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- # Post timeout comment
- - name: Post timeout comment
+ - name: โฑ๏ธ Update PR Comment (Timeout)
if: steps.check_status.outputs.status == 'timeout'
- uses: thollander/actions-comment-pull-request@v2
+ uses: actions/github-script@v7
with:
- message: |
- ### โฑ๏ธ Netlify Deployment Status: Timeout
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โฑ๏ธ Updating PR comment with timeout status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentBody = `### โฑ๏ธ Netlify Deployment Status: Timeout
โ ๏ธ The deployment is taking longer than expected (>30 minutes).
@@ -477,15 +617,23 @@ jobs:
**Next steps:**
1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status
- 2. Look for branch: `${{ steps.netlify_build.outputs.branch_name }}`
+ 2. Look for branch: ${{ steps.netlify_build.outputs.branch_name }}
3. If the build is still running, please wait for it to complete
- 4. If needed, you can re-trigger with another `netlify build` comment
+ 4. If needed, you can re-trigger with another \`netlify build\` comment
**Expected preview URL (once ready):**
- https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app
- comment_tag: manual-build-comment
+ https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app`;
+
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: ${{ steps.initial_comment.outputs.comment_id }},
+ body: commentBody
+ });
+
+ console.log('โฑ๏ธ Timeout comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- # Fail the workflow if deployment failed
- name: Fail workflow on deployment failure
if: steps.check_status.outputs.status == 'failure'
run: |
From 48e9c34fa379688c5f3ff48c25368aa08ece05d1 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 00:36:57 +0530
Subject: [PATCH 16/43] chore: hopefully cosmetic changes should work now?
---
.../workflows/final-manual-deploy-comment.yml | 26 ++++++++++++++-----
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index ccc48fda58a..11ead4d5447 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -245,8 +245,8 @@ jobs:
for i in {1..10}; do
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ ๐ Attempt $i/10 "
- echo "โ ๐ Time: $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S IST') "
+ echo "โ ๐ Attempt $i/10"
+ echo "โ ๐ Time: $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S IST')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
@@ -293,6 +293,7 @@ jobs:
if [ $i -lt 10 ]; then
echo " โณ Not found yet, waiting 15 seconds..."
+ sleep 15
fi
done
@@ -352,11 +353,22 @@ jobs:
console.log('๐ Updating PR comment with deployment details...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ const deployFoundVia = '${{ steps.poll_netlify.outputs.deploy_found_via }}';
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
+
+ let detailLine = '';
+ if (deployFoundVia === 'commit') {
+ detailLine = `- **Commit SHA:** \`${sha}\``;
+ } else {
+ detailLine = `- **Branch Name:** \`${branchName}\``;
+ }
+
const commentBody = `### ๐ Netlify Deployment In Progress
- The deployment was found via **${{ steps.poll_netlify.outputs.deploy_found_via }}-based validation**.
+ The deployment was found via **${deployFoundVia}-based validation**.
- ${{ steps.poll_netlify.outputs.deploy_found_via == 'commit' && format('- **Commit SHA:** `{0}`', steps.netlify_build.outputs.sha) || format('- **Branch Name:** `{0}`', steps.netlify_build.outputs.branch_name) }}
+ ${detailLine}
- **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
- **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}
@@ -416,9 +428,9 @@ jobs:
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ ๐ Status Check "
- echo "โ โฑ๏ธ Elapsed: ${MINUTES_ELAPSED}/30.0 minutes "
- echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S') "
+ echo "โ ๐ Status Check"
+ echo "โ โฑ๏ธ Elapsed: ${MINUTES_ELAPSED}/30.0 minutes"
+ echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
if [ "$USE_FALLBACK" = "true" ]; then
From 2af0fc922ed7a7171d64eceb2c30afd47bc472f4 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 01:08:30 +0530
Subject: [PATCH 17/43] chore: hopefully cosmetic changes should work now?
---
.../workflows/final-manual-deploy-comment.yml | 183 +++++-------------
1 file changed, 52 insertions(+), 131 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 11ead4d5447..d55d9af9990 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: ๐ Verify Repository Source
+ - name: Verify Repository Source
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -42,7 +42,7 @@ jobs:
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
fi
- - name: ๐ Validate Team Membership
+ - name: Validate Team Membership
# Only run this check for issue_comment events (manual triggers)
# For pull_request events, the PR author is implicitly authorized
@@ -131,10 +131,10 @@ jobs:
console.log(`โ
${commenter} is authorized to trigger builds`);
}
- - name: ๐ ๏ธ Initialize Dependencies
+ - name: Initialize Dependencies
uses: dcarbone/install-jq-action@v2
- - name: ๐ Trigger Netlify Deployment
+ - name: Trigger Netlify Deployment
id: netlify_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -181,7 +181,7 @@ jobs:
SANITIZED_BRANCH_NAME=$(echo "${{ steps.netlify_build.outputs.branch_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr 'A-Z' 'a-z')
echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- - name: ๐ Create PR Status Comment
+ - name: Create PR Status Comment
id: initial_comment
uses: actions/github-script@v7
with:
@@ -190,16 +190,19 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('๐ Creating initial PR comment...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
+ const triggerEpoch = Number('${{ steps.netlify_build.outputs.trigger_time }}') * 1000;
+ const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const prNumber = '${{ steps.netlify_build.outputs.pr_number }}';
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
+
+ const body = `### ๐ Netlify Preview Building!\n\nBuild triggered for PR #${prNumber}\n\n- **Branch:** \`${branchName}\`\n- **Commit SHA:** \`${sha}\`\n- **Triggered At (IST):** ${triggeredAtIST}\n\nโณ Monitoring deployment status... This usually takes 10-20 minutes.`;
+
const { data: comment } = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
- issue_number: ${{ steps.netlify_build.outputs.pr_number }},
- body: `### ๐ Netlify Preview Building!
-
- Build triggered for PR #${{ steps.netlify_build.outputs.pr_number }} (commit: \`${{ steps.netlify_build.outputs.sha }}\`)
-
- โณ Monitoring deployment status... This usually takes 10-20 minutes.`
+ issue_number: Number(prNumber),
+ body
});
console.log('โ
Comment created successfully');
@@ -207,7 +210,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
core.setOutput('comment_id', comment.id);
- - name: ๐ Locate Netlify Deployment
+ - name: Locate Netlify Deployment
id: poll_netlify
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -343,7 +346,7 @@ jobs:
fi
fi
- - name: ๐ Update PR Comment (Deployment Found)
+ - name: Update PR Comment (Deployment Found)
if: steps.poll_netlify.outputs.deploy_id != ''
uses: actions/github-script@v7
with:
@@ -352,39 +355,27 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('๐ Updating PR comment with deployment details...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const deployFoundVia = '${{ steps.poll_netlify.outputs.deploy_found_via }}';
- const sha = '${{ steps.netlify_build.outputs.sha }}';
- const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
-
- let detailLine = '';
- if (deployFoundVia === 'commit') {
- detailLine = `- **Commit SHA:** \`${sha}\``;
- } else {
- detailLine = `- **Branch Name:** \`${branchName}\``;
- }
-
- const commentBody = `### ๐ Netlify Deployment In Progress
-
- The deployment was found via **${deployFoundVia}-based validation**.
-
- ${detailLine}
- - **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
- - **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}
-
- โณ Build is currently in progress. Monitoring status...`;
-
- await github.rest.issues.updateComment({
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({
owner: context.repo.owner,
repo: context.repo.repo,
- comment_id: ${{ steps.initial_comment.outputs.comment_id }},
- body: commentBody
+ comment_id: commentId
});
+ const deployFoundVia = '${{ steps.poll_netlify.outputs.deploy_found_via }}';
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const detailLine = deployFoundVia === 'commit'
+ ? `- **Commit SHA:** \`${sha}\``
+ : `- **Branch Name:** \`${branchName}\``;
+ const append = `---\n\n### ๐ Netlify Deployment In Progress\n\nThe deployment was found via **${deployFoundVia}-based validation**.\n\n${detailLine}\n- **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})\n- **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}\n- **Update Logged At (IST):** ${updateIST}\n\nโณ Build is currently in progress. Monitoring status...`;
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
console.log('โ
PR comment updated successfully');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- - name: ๐ Monitor Deployment Status
+ - name: Monitor Deployment Status
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -519,7 +510,7 @@ jobs:
echo "status=timeout" >> $GITHUB_OUTPUT
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- - name: โ
Update PR Comment (Success)
+ - name: Update PR Comment (Success)
if: steps.check_status.outputs.status == 'success'
uses: actions/github-script@v7
with:
@@ -528,28 +519,17 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โ
Updating PR comment with success status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentBody = `### โ
Netlify Preview Deploy Successful!
-
- Your preview deployment has completed successfully and is now live!
-
- ๐ **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
-
- The preview is ready for review. Please test your changes thoroughly before merging.`;
-
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: ${{ steps.initial_comment.outputs.comment_id }},
- body: commentBody
- });
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const append = `---\n\n### โ
Netlify Preview Deploy Successful!\n\nYour preview deployment has completed successfully and is now live!\n\n๐ **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n- **Completed At (IST):** ${updateIST}\n\nThe preview is ready for review. Please test your changes thoroughly before merging.`;
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
console.log('โ
Success comment posted');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- - name: โ Update PR Comment (Failure)
+ - name: Update PR Comment (Failure)
if: steps.check_status.outputs.status == 'failure'
uses: actions/github-script@v7
with:
@@ -558,54 +538,17 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โ Updating PR comment with failure status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentBody = `# ๐จ โ 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:** \`${{ steps.check_status.outputs.deploy_id }}\`
- - **Error Message:**
- \`\`\`
- ${{ steps.check_status.outputs.error_message }}
- \`\`\`
-
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
-
- ### ๐ ๏ธ 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 ๐ด**`;
-
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: ${{ steps.initial_comment.outputs.comment_id }},
- body: commentBody
- });
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const append = `---\n\n# ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ\n\n## โ **DO NOT MERGE THIS PR** โ\n\nThe Netlify preview deployment has **FAILED**. This PR contains changes that break the build process.\n\n### ๐ด Critical Issue Details:\n\n- **Status:** Build Failed\n- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`\n- **Error Message:** \n\`\`\`\n${{ steps.check_status.outputs.error_message }}\n\`\`\`\n- **Failed At (IST):** ${updateIST}\n\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n### ๐ ๏ธ Required Actions:\n\n1. **Review the error message above carefully**\n2. **Fix the build issues in your branch**\n3. **Test locally before pushing changes**\n4. **Trigger a new build with \`netlify build\` comment once fixed**\n\n### โ ๏ธ WARNING TO MAINTAINERS:\n\n**This PR has a failing build and should NOT be merged until:**\n- โ
All build errors are resolved\n- โ
A successful deployment preview is confirmed\n- โ
The preview site has been manually tested\n\n---\n\n**๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**`;
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
console.log('โ Failure comment posted');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- - name: โฑ๏ธ Update PR Comment (Timeout)
+ - name: Update PR Comment (Timeout)
if: steps.check_status.outputs.status == 'timeout'
uses: actions/github-script@v7
with:
@@ -614,34 +557,12 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โฑ๏ธ Updating PR comment with timeout status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentBody = `### โฑ๏ธ Netlify Deployment Status: Timeout
-
- โ ๏ธ The deployment is taking longer than expected (>30 minutes).
-
- **Possible reasons:**
- - The build is still in progress
- - Netlify is experiencing delays
- - The build queue is backed up
-
- ๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- ๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
-
- **Next steps:**
- 1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status
- 2. Look for branch: ${{ steps.netlify_build.outputs.branch_name }}
- 3. If the build is still running, please wait for it to complete
- 4. If needed, you can re-trigger with another \`netlify build\` comment
-
- **Expected preview URL (once ready):**
- https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app`;
-
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: ${{ steps.initial_comment.outputs.comment_id }},
- body: commentBody
- });
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const append = `---\n\n### โฑ๏ธ Netlify Deployment Status: Timeout\n\nโ ๏ธ The deployment is taking longer than expected (>30 minutes).\n\n**Possible reasons:**\n- The build is still in progress\n- Netlify is experiencing delays\n- The build queue is backed up\n- **Timeout Reached At (IST):** ${updateIST}\n\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n**Next steps:**\n1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status\n2. Look for branch: ${{ steps.netlify_build.outputs.branch_name }}\n3. If the build is still running, please wait for it to complete\n4. If needed, you can re-trigger with another \`netlify build\` comment\n\n**Expected preview URL (once ready):**\nhttps://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app`;
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
console.log('โฑ๏ธ Timeout comment posted');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
From c8b24e176982efdf9820943c4c6afb3072ecd80e Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 11:58:34 +0530
Subject: [PATCH 18/43] chore: more cosmetic changes
---
.../workflows/final-manual-deploy-comment.yml | 115 +++++++++++++++---
1 file changed, 95 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index d55d9af9990..51decdf80df 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -24,7 +24,7 @@ jobs:
echo "๐ Checking if PR is from a forked repository..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- PR_URL="${{ github.event.issue.pull_request.url }}"
+ PR_URL="${{ github.event.issue.pull_request.url || github.event.pull_request.url }}"
IS_FORK=$(gh api "$PR_URL" --jq '.head.repo.fork')
if [[ "$IS_FORK" == "true" ]]; then
@@ -44,11 +44,6 @@ jobs:
- name: Validate Team Membership
# Only run this check for issue_comment events (manual triggers)
- # For pull_request events, the PR author is implicitly authorized
-
- # ##########################################################################################
- # REMOVE THIS CONDITION AFTER TESTING THIS WORKFLOW, THIS SHOULD NOT MAKE IT TO THE MERGE
- # ##########################################################################################
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.DOCS_ENG_TEAM_MEMBERSHIP_CHECKER }}
@@ -143,7 +138,7 @@ jobs:
echo "๐ NETLIFY DEPLOYMENT TRIGGER"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com//')
+ gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
sha=$(echo $gh_api_response | jq -r .head.sha)
@@ -190,13 +185,21 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('๐ Creating initial PR comment...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
const triggerEpoch = Number('${{ steps.netlify_build.outputs.trigger_time }}') * 1000;
- const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const prNumber = '${{ steps.netlify_build.outputs.pr_number }}';
const sha = '${{ steps.netlify_build.outputs.sha }}';
const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
- const body = `### ๐ Netlify Preview Building!\n\nBuild triggered for PR #${prNumber}\n\n- **Branch:** \`${branchName}\`\n- **Commit SHA:** \`${sha}\`\n- **Triggered At (IST):** ${triggeredAtIST}\n\nโณ Monitoring deployment status... This usually takes 10-20 minutes.`;
+ const body = `### ๐ Netlify Preview Building...
+ (Update logged at: ${triggeredAtIST} IST | Commit: \`${sha}\`)
+
+ - **PR:** #${prNumber}
+ - **Branch:** \`${branchName}\`
+ - **Status:** Build triggered on Netlify.
+
+ โณ Monitoring deployment status... This usually takes 10-20 minutes.`;
const { data: comment } = await github.rest.issues.createComment({
owner: context.repo.owner,
@@ -355,20 +358,32 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('๐ Updating PR comment with deployment details...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId
});
+
const deployFoundVia = '${{ steps.poll_netlify.outputs.deploy_found_via }}';
const sha = '${{ steps.netlify_build.outputs.sha }}';
- const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const detailLine = deployFoundVia === 'commit'
- ? `- **Commit SHA:** \`${sha}\``
- : `- **Branch Name:** \`${branchName}\``;
- const append = `---\n\n### ๐ Netlify Deployment In Progress\n\nThe deployment was found via **${deployFoundVia}-based validation**.\n\n${detailLine}\n- **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})\n- **Deployment Created At (IST):** ${{ steps.poll_netlify.outputs.created_at_ist }}\n- **Update Logged At (IST):** ${updateIST}\n\nโณ Build is currently in progress. Monitoring status...`;
+ ? `- **Validation:** Commit-based (\`${sha}\`)`
+ : `- **Validation:** Branch-based`;
+
+ const append = `---
+ ### โณ Netlify Deployment In Progress
+ (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+
+ - **Status:** Deployment found on Netlify.
+ ${detailLine}
+ - **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
+ - **Deployment Created:** ${{ steps.poll_netlify.outputs.created_at_ist }}
+
+ โณ Build is currently in progress. Monitoring status...`;
+
const body = `${existing.data.body}\n\n${append}`;
await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
@@ -519,10 +534,23 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โ
Updating PR comment with success status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
- const append = `---\n\n### โ
Netlify Preview Deploy Successful!\n\nYour preview deployment has completed successfully and is now live!\n\n๐ **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n- **Completed At (IST):** ${updateIST}\n\nThe preview is ready for review. Please test your changes thoroughly before merging.`;
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+
+ const append = `---
+ ### โ
Netlify Preview Deploy Successful!
+ (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+
+ - **Status:** Build Succeeded
+ - **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})
+ - **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
+ - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+
+ The preview is ready for review. Please test your changes thoroughly before merging.`;
+
const body = `${existing.data.body}\n\n${append}`;
await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
@@ -538,10 +566,41 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โ Updating PR comment with failure status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
- const append = `---\n\n# ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ\n\n## โ **DO NOT MERGE THIS PR** โ\n\nThe Netlify preview deployment has **FAILED**. This PR contains changes that break the build process.\n\n### ๐ด Critical Issue Details:\n\n- **Status:** Build Failed\n- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`\n- **Error Message:** \n\`\`\`\n${{ steps.check_status.outputs.error_message }}\n\`\`\`\n- **Failed At (IST):** ${updateIST}\n\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n### ๐ ๏ธ Required Actions:\n\n1. **Review the error message above carefully**\n2. **Fix the build issues in your branch**\n3. **Test locally before pushing changes**\n4. **Trigger a new build with \`netlify build\` comment once fixed**\n\n### โ ๏ธ WARNING TO MAINTAINERS:\n\n**This PR has a failing build and should NOT be merged until:**\n- โ
All build errors are resolved\n- โ
A successful deployment preview is confirmed\n- โ
The preview site has been manually tested\n\n---\n\n**๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**`;
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const errorMessage = `${{ steps.check_status.outputs.error_message }}`.trim() || "No error message provided by Netlify. Please check the log.";
+
+ const append = `---
+ # ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ
+ (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+
+ ## โ **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:** \`${{ steps.check_status.outputs.deploy_id }}\`
+ - **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
+ - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ - **Error Message:** \`\`\`
+ ${errorMessage}
+ \`\`\`
+
+ ### ๐ ๏ธ Required Actions:
+ 1. **Review the error message and Netlify log carefully.**
+ 2. **Fix the build issues in your branch.**
+ 3. **Trigger a new build with \`netlify build\` comment once fixed.**
+
+ ### โ ๏ธ WARNING TO MAINTAINERS:
+ **This PR has a failing build and should NOT be merged.**
+
+ ---
+ **๐ด MERGING THIS PR IN ITS CURRENT STATE WILL BREAK PRODUCTION ๐ด**`;
+
const body = `${existing.data.body}\n\n${append}`;
await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
@@ -557,10 +616,26 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
console.log('โฑ๏ธ Updating PR comment with timeout status...');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });
- const append = `---\n\n### โฑ๏ธ Netlify Deployment Status: Timeout\n\nโ ๏ธ The deployment is taking longer than expected (>30 minutes).\n\n**Possible reasons:**\n- The build is still in progress\n- Netlify is experiencing delays\n- The build queue is backed up\n- **Timeout Reached At (IST):** ${updateIST}\n\n๐ **Netlify Deployment:** [View Deployment](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})\n๐ **GitHub Actions Job:** [View Job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n**Next steps:**\n1. Check the [Netlify dashboard](https://app.netlify.com) manually for deployment status\n2. Look for branch: ${{ steps.netlify_build.outputs.branch_name }}\n3. If the build is still running, please wait for it to complete\n4. If needed, you can re-trigger with another \`netlify build\` comment\n\n**Expected preview URL (once ready):**\nhttps://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app`;
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+
+ const append = `---
+ ### โฑ๏ธ Netlify Deployment Status: Timeout
+ (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+
+ - **Status:** Timeout Reached (>30 minutes)
+ - **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
+ - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ - **Expected Preview URL:** \`https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app\`
+
+ **Next steps:**
+ 1. Check the [Netlify dashboard](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }}) manually for status.
+ 2. If the build is still running, please wait.
+ 3. If needed, re-trigger with a new \`netlify build\` comment.`;
+
const body = `${existing.data.body}\n\n${append}`;
await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
From 3aa8f445ee8b6acdfe9c99f3f9aeff2147e1fc7b Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Sun, 9 Nov 2025 12:26:00 +0530
Subject: [PATCH 19/43] chore: more cosmetic changes
---
.../workflows/final-manual-deploy-comment.yml | 49 ++++++++++++++-----
1 file changed, 37 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 51decdf80df..a1c454fc612 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -190,14 +190,19 @@ jobs:
const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const prNumber = '${{ steps.netlify_build.outputs.pr_number }}';
const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
const branchName = '${{ steps.netlify_build.outputs.branch_name }}';
const body = `### ๐ Netlify Preview Building...
- (Update logged at: ${triggeredAtIST} IST | Commit: \`${sha}\`)
+ (Update logged at: ${triggeredAtIST} IST | Commit: ${commitLink})
- **PR:** #${prNumber}
- **Branch:** \`${branchName}\`
- **Status:** Build triggered on Netlify.
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
โณ Monitoring deployment status... This usually takes 10-20 minutes.`;
@@ -240,8 +245,8 @@ jobs:
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo ""
- echo "โณ Waiting 30 seconds for Netlify to register the deployment..."
- sleep 30
+ echo "โณ Waiting 45 seconds for Netlify to register the deployment..."
+ sleep 45
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
@@ -368,18 +373,26 @@ jobs:
const deployFoundVia = '${{ steps.poll_netlify.outputs.deploy_found_via }}';
const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
+ const deployId = '${{ steps.poll_netlify.outputs.deploy_id }}';
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+
const detailLine = deployFoundVia === 'commit'
- ? `- **Validation:** Commit-based (\`${sha}\`)`
+ ? `- **Validation:** Commit-based (${commitLink})`
: `- **Validation:** Branch-based`;
const append = `---
### โณ Netlify Deployment In Progress
- (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
- **Status:** Deployment found on Netlify.
+ - **Deploy ID:** \`${deployId}\`
${detailLine}
- **Netlify Build URL:** [View Deployment](${{ steps.poll_netlify.outputs.build_url }})
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
- **Deployment Created:** ${{ steps.poll_netlify.outputs.created_at_ist }}
โณ Build is currently in progress. Monitoring status...`;
@@ -539,15 +552,19 @@ jobs:
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
const append = `---
### โ
Netlify Preview Deploy Successful!
- (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
- **Status:** Build Succeeded
- **Preview URL:** [${{ steps.check_status.outputs.deploy_url }}](${{ steps.check_status.outputs.deploy_url }})
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
The preview is ready for review. Please test your changes thoroughly before merging.`;
@@ -571,11 +588,15 @@ jobs:
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
const errorMessage = `${{ steps.check_status.outputs.error_message }}`.trim() || "No error message provided by Netlify. Please check the log.";
const append = `---
# ๐จ โ NETLIFY DEPLOYMENT FAILED โ ๐จ
- (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
## โ **DO NOT MERGE THIS PR** โ
@@ -585,7 +606,7 @@ jobs:
- **Status:** Build Failed
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
- **Error Message:** \`\`\`
${errorMessage}
\`\`\`
@@ -619,16 +640,20 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
const append = `---
### โฑ๏ธ Netlify Deployment Status: Timeout
- (Update logged at: ${updateIST} IST | Commit: \`${sha}\`)
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
- **Status:** Timeout Reached (>30 minutes)
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- - **GitHub Actions Job:** [View Job Log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
- **Expected Preview URL:** \`https://${{ steps.sanitize_branch.outputs.name }}--docs-website-netlify.netlify.app\`
**Next steps:**
From 4e8055f20bbe965e7590d801597529ea43551ab5 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:05:22 +0530
Subject: [PATCH 20/43] chore: probably the final set of cosmetic changes to
logs
---
.github/workflows/final-manual-deploy-comment.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index a1c454fc612..afa558c722b 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -285,7 +285,7 @@ jobs:
echo "๐ฆ Deployment Information:"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo " ๐ Deploy ID: $DEPLOY_ID"
- echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
echo " ๐
Created (UTC): $CREATED_AT"
echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
echo " โ
Method: Commit-based validation"
@@ -331,7 +331,7 @@ jobs:
echo "๐ฆ Deployment Information:"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo " ๐ Deploy ID: $DEPLOY_ID"
- echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
echo " ๐
Created (UTC): $CREATED_AT"
echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
echo " โ ๏ธ Method: Branch-based validation (fallback)"
@@ -487,7 +487,7 @@ jobs:
echo "๐ Deployment Details:"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo " ๐ Preview URL: $DEPLOY_URL"
- echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
echo " ๐ Deploy ID: $DEPLOY_ID"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
@@ -503,7 +503,7 @@ jobs:
echo ""
echo "๐ฅ Error Details:"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo " ๐ Build URL: $BUILD_URL"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
echo " ๐ Deploy ID: $DEPLOY_ID"
echo " ๐ Error: $ERROR_MESSAGE"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
@@ -514,7 +514,7 @@ jobs:
exit 0
elif [ "$STATE" = "building" ] || [ "$STATE" = "enqueued" ] || [ "$STATE" = "processing" ]; then
echo " โณ Status: In Progress ($STATE)"
- echo " ๐ Build: $BUILD_URL"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
else
echo " โ ๏ธ Status: Unknown ($STATE)"
fi
From b471f8f09cb5d84614c13a23d7c751345643c11c Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:06:05 +0530
Subject: [PATCH 21/43] chore: introduce immediate change to test parallel
build that will break
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index e48c12e63cc..f1740a9aff5 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-30'
+releaseDate: '2025-06-31'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From 00ea5c5ec1adc42637051f736c6f0008bea2da96 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:28:52 +0530
Subject: [PATCH 22/43] chore: workflow concurrency test 1
---
.../workflows/final-manual-deploy-comment.yml | 221 ++++++++++++------
1 file changed, 148 insertions(+), 73 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index afa558c722b..484b9783b5c 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -296,7 +296,9 @@ jobs:
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
- break
+
+ echo "status=found" >> $GITHUB_OUTPUT
+ exit 0 # Exit script successfully
else
echo " โ ๏ธ Found deployment but it's too old (${TIME_DIFF}s offset)"
fi
@@ -308,54 +310,60 @@ jobs:
fi
done
- if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+ # If we're here, the loop finished and no commit-based deploy was found.
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ CHECKING FOR CONCURRENT BUILDS (ON BRANCH) โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "Could not find deployment for commit $SHA. Checking for other active builds on branch $BRANCH_NAME..."
+
+ # $DEPLOYS is still in scope from the loop
+ ACTIVE_DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch and (.state == "building" or .state == "enqueued" or .state == "processing"))] |
+ sort_by(.created_at) | reverse | .[0]')
+
+ if [ "$ACTIVE_DEPLOY" != "null" ] && [ -n "$ACTIVE_DEPLOY" ]; then
+ ACTIVE_DEPLOY_ID=$(echo "$ACTIVE_DEPLOY" | jq -r '.id')
+ ACTIVE_COMMIT_SHA=$(echo "$ACTIVE_DEPLOY" | jq -r '.commit_ref // .head')
+ ACTIVE_BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$ACTIVE_DEPLOY_ID"
+
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ FALLBACK: SEARCHING BY BRANCH NAME โ"
+ echo "โ โ ๏ธ CONCURRENT BUILD DETECTED โ"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "Another build is already in progress for this branch."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Active Deploy ID: $ACTIVE_DEPLOY_ID"
+ echo " ๐ Active Commit: $ACTIVE_COMMIT_SHA"
+ echo " ๐ Active Build URL: $ACTIVE_BUILD_URL"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "This workflow (for commit $SHA) will be terminated."
- DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+ echo "status=concurrent_build" >> $GITHUB_OUTPUT
+ echo "active_deploy_id=$ACTIVE_DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "active_commit_sha=$ACTIVE_COMMIT_SHA" >> $GITHUB_OUTPUT
+ echo "active_build_url=$ACTIVE_BUILD_URL" >> $GITHUB_OUTPUT
+ exit 0
- if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
- DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
- CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
- CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
- BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
-
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ
DEPLOYMENT FOUND (BRANCH-BASED) โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "๐ฆ Deployment Information:"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo " ๐ Deploy ID: $DEPLOY_ID"
- echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
- echo " ๐
Created (UTC): $CREATED_AT"
- echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
- echo " โ ๏ธ Method: Branch-based validation (fallback)"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- DEPLOY_FOUND_VIA="branch"
-
- echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
- echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
- echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
- else
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ DEPLOYMENT NOT FOUND โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "No deployment could be located using either method."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- exit 1
- fi
+ else
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ DEPLOYMENT NOT FOUND โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "No deployment could be located for commit $SHA."
+ echo "No other active builds were found on this branch."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ echo "status=not_found" >> $GITHUB_OUTPUT
+ exit 0
fi
- name: Update PR Comment (Deployment Found)
- if: steps.poll_netlify.outputs.deploy_id != ''
+ if: steps.poll_netlify.outputs.status == 'found'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -382,7 +390,7 @@ jobs:
const detailLine = deployFoundVia === 'commit'
? `- **Validation:** Commit-based (${commitLink})`
- : `- **Validation:** Branch-based`;
+ : `- **Validation:** Branch-based`; // This line should not be hit based on new logic, but safe to keep
const append = `---
### โณ Netlify Deployment In Progress
@@ -403,7 +411,92 @@ jobs:
console.log('โ
PR comment updated successfully');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ # *** NEW STEP ***
+ - name: Update PR Comment (Concurrent Build)
+ if: steps.poll_netlify.outputs.status == 'concurrent_build'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ ๏ธ Updating PR comment with concurrent build status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
+
+ const activeSha = '${{ steps.poll_netlify.outputs.active_commit_sha }}';
+ const activeShortSha = activeSha ? activeSha.substring(0, 7) : 'unknown';
+ const activeCommitLink = activeSha ? `[\`${activeShortSha}\`](https://github.com/${repo}/commit/${activeSha})` : '`unknown`';
+ const activeBuildUrl = '${{ steps.poll_netlify.outputs.active_build_url }}';
+
+ const append = `---
+ ### โ ๏ธ Netlify Deployment Halted
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
+
+ - **Status:** Concurrent build detected.
+ - **This Workflow (for commit ${commitLink}):** Halted.
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
+
+ Another build for this branch is already in progress on Netlify.
+ - **In-Progress Commit:** ${activeCommitLink}
+ - **In-Progress Netlify Log:** [View Active Deployment](${activeBuildUrl})
+
+ Please wait for the active build to complete. If you need to build this commit, please trigger a new build *after* the other one has finished.`;
+
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
+
+ console.log('โ ๏ธ Concurrent build comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ - name: Update PR Comment (Not Found)
+ if: steps.poll_netlify.outputs.status == 'not_found'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ Updating PR comment with deployment not found status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
+
+ const append = `---
+ ### โ Netlify Deployment Not Found
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
+
+ - **Status:** Deployment Not Found
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
+
+ The workflow could not find a matching deployment on Netlify for commit ${commitLink} after 10 attempts.
+ No other active builds for this branch were found.
+
+ **Next steps:**
+ 1. Check the [Netlify dashboard](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys) to see if the build was triggered.
+ 2. If needed, re-trigger with a new \`netlify build\` comment.`;
+
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
+
+ console.log('โ Not found comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
- name: Monitor Deployment Status
+ if: steps.poll_netlify.outputs.status == 'found'
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -416,7 +509,9 @@ jobs:
MAX_WAIT_TIME=1800
POLL_INTERVAL=90
ELAPSED_TIME=0
- USE_FALLBACK=false
+
+ # This step now only runs if a deploy_id was found.
+ # The 'USE_FALLBACK' logic is no longer needed.
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "๐ DEPLOYMENT STATUS MONITORING"
@@ -431,12 +526,6 @@ jobs:
echo " ๐ Started (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
- echo ""
- echo "โ ๏ธ WARNING: No Deploy ID found. Using branch-based fallback."
- USE_FALLBACK=true
- fi
-
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ POLLING DEPLOYMENT STATUS โ"
@@ -452,30 +541,15 @@ jobs:
echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- if [ "$USE_FALLBACK" = "true" ]; then
- DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
-
- DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
- else
- DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
- fi
+ DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
STATE=$(echo "$DEPLOY" | jq -r '.state')
- CURRENT_DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
-
BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
- if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
- DEPLOY_ID=$CURRENT_DEPLOY_ID
- echo " ๐ Deployment ID: $DEPLOY_ID"
- fi
-
echo " ๐ Current State: $STATE"
if [ "$STATE" = "ready" ]; then
@@ -539,7 +613,7 @@ jobs:
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- name: Update PR Comment (Success)
- if: steps.check_status.outputs.status == 'success'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'success'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -575,7 +649,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Failure)
- if: steps.check_status.outputs.status == 'failure'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -607,7 +681,8 @@ jobs:
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- **GitHub Actions Job:** [View Job Log](${jobUrl})
- - **Error Message:** \`\`\`
+ - **Error Message:**
+ \`\`\`
${errorMessage}
\`\`\`
@@ -629,7 +704,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Timeout)
- if: steps.check_status.outputs.status == 'timeout'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'timeout'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -640,7 +715,7 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
const repo = '${{ github.repository }}';
@@ -668,7 +743,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Fail workflow on deployment failure
- if: steps.check_status.outputs.status == 'failure'
+ if: (steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure') || steps.poll_netlify.outputs.status == 'not_found'
run: |
- echo "::error::Netlify deployment failed. This PR should not be merged."
+ echo "::error::Netlify deployment failed or was not found. This PR should not be merged."
exit 1
\ No newline at end of file
From a3d60274e468e4759bfe26f58aee225c11b23d00 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:29:23 +0530
Subject: [PATCH 23/43] chore: workflow concurrency test 1, change to trigger
concurrency
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index f1740a9aff5..e48c12e63cc 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-31'
+releaseDate: '2025-06-30'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From 21ca8d083e41838ba954a0df547477191940bc11 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:36:33 +0530
Subject: [PATCH 24/43] chore: revert concurrency logic, revisit tomorrow
This reverts commit a3d60274e468e4759bfe26f58aee225c11b23d00.
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index e48c12e63cc..f1740a9aff5 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-30'
+releaseDate: '2025-06-31'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From 516e1a602807595aa4b43c9867cf63d006ac4357 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:37:25 +0530
Subject: [PATCH 25/43] chore: revert concurrency logic, revisit tomorrow
This reverts commit 00ea5c5ec1adc42637051f736c6f0008bea2da96.
---
.../workflows/final-manual-deploy-comment.yml | 221 ++++++------------
1 file changed, 73 insertions(+), 148 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 484b9783b5c..afa558c722b 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -296,9 +296,7 @@ jobs:
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
-
- echo "status=found" >> $GITHUB_OUTPUT
- exit 0 # Exit script successfully
+ break
else
echo " โ ๏ธ Found deployment but it's too old (${TIME_DIFF}s offset)"
fi
@@ -310,60 +308,54 @@ jobs:
fi
done
- # If we're here, the loop finished and no commit-based deploy was found.
-
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ CHECKING FOR CONCURRENT BUILDS (ON BRANCH) โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "Could not find deployment for commit $SHA. Checking for other active builds on branch $BRANCH_NAME..."
-
- # $DEPLOYS is still in scope from the loop
- ACTIVE_DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch and (.state == "building" or .state == "enqueued" or .state == "processing"))] |
- sort_by(.created_at) | reverse | .[0]')
-
- if [ "$ACTIVE_DEPLOY" != "null" ] && [ -n "$ACTIVE_DEPLOY" ]; then
- ACTIVE_DEPLOY_ID=$(echo "$ACTIVE_DEPLOY" | jq -r '.id')
- ACTIVE_COMMIT_SHA=$(echo "$ACTIVE_DEPLOY" | jq -r '.commit_ref // .head')
- ACTIVE_BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$ACTIVE_DEPLOY_ID"
-
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ ๏ธ CONCURRENT BUILD DETECTED โ"
+ echo "โ FALLBACK: SEARCHING BY BRANCH NAME โ"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "Another build is already in progress for this branch."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo " ๐ Active Deploy ID: $ACTIVE_DEPLOY_ID"
- echo " ๐ Active Commit: $ACTIVE_COMMIT_SHA"
- echo " ๐ Active Build URL: $ACTIVE_BUILD_URL"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "This workflow (for commit $SHA) will be terminated."
- echo "status=concurrent_build" >> $GITHUB_OUTPUT
- echo "active_deploy_id=$ACTIVE_DEPLOY_ID" >> $GITHUB_OUTPUT
- echo "active_commit_sha=$ACTIVE_COMMIT_SHA" >> $GITHUB_OUTPUT
- echo "active_build_url=$ACTIVE_BUILD_URL" >> $GITHUB_OUTPUT
- exit 0
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
- else
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ DEPLOYMENT NOT FOUND โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "No deployment could be located for commit $SHA."
- echo "No other active builds were found on this branch."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-
- echo "status=not_found" >> $GITHUB_OUTPUT
- exit 0
+ if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
+ DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
+ CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
+ CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ
DEPLOYMENT FOUND (BRANCH-BASED) โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ฆ Deployment Information:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
+ echo " ๐
Created (UTC): $CREATED_AT"
+ echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
+ echo " โ ๏ธ Method: Branch-based validation (fallback)"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ DEPLOY_FOUND_VIA="branch"
+
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
+ echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
+ else
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ DEPLOYMENT NOT FOUND โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "No deployment could be located using either method."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ exit 1
+ fi
fi
- name: Update PR Comment (Deployment Found)
- if: steps.poll_netlify.outputs.status == 'found'
+ if: steps.poll_netlify.outputs.deploy_id != ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -390,7 +382,7 @@ jobs:
const detailLine = deployFoundVia === 'commit'
? `- **Validation:** Commit-based (${commitLink})`
- : `- **Validation:** Branch-based`; // This line should not be hit based on new logic, but safe to keep
+ : `- **Validation:** Branch-based`;
const append = `---
### โณ Netlify Deployment In Progress
@@ -411,92 +403,7 @@ jobs:
console.log('โ
PR comment updated successfully');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- # *** NEW STEP ***
- - name: Update PR Comment (Concurrent Build)
- if: steps.poll_netlify.outputs.status == 'concurrent_build'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- console.log('โ ๏ธ Updating PR comment with concurrent build status...');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
- const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
- const sha = '${{ steps.netlify_build.outputs.sha }}';
- const shortSha = sha.substring(0, 7);
- const repo = '${{ github.repository }}';
- const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
- const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
-
- const activeSha = '${{ steps.poll_netlify.outputs.active_commit_sha }}';
- const activeShortSha = activeSha ? activeSha.substring(0, 7) : 'unknown';
- const activeCommitLink = activeSha ? `[\`${activeShortSha}\`](https://github.com/${repo}/commit/${activeSha})` : '`unknown`';
- const activeBuildUrl = '${{ steps.poll_netlify.outputs.active_build_url }}';
-
- const append = `---
- ### โ ๏ธ Netlify Deployment Halted
- (Update logged at: ${updateIST} IST | Commit: ${commitLink})
-
- - **Status:** Concurrent build detected.
- - **This Workflow (for commit ${commitLink}):** Halted.
- - **GitHub Actions Job:** [View Job Log](${jobUrl})
-
- Another build for this branch is already in progress on Netlify.
- - **In-Progress Commit:** ${activeCommitLink}
- - **In-Progress Netlify Log:** [View Active Deployment](${activeBuildUrl})
-
- Please wait for the active build to complete. If you need to build this commit, please trigger a new build *after* the other one has finished.`;
-
- const body = `${existing.data.body}\n\n${append}`;
- await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
-
- console.log('โ ๏ธ Concurrent build comment posted');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- - name: Update PR Comment (Not Found)
- if: steps.poll_netlify.outputs.status == 'not_found'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- console.log('โ Updating PR comment with deployment not found status...');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
- const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
- const sha = '${{ steps.netlify_build.outputs.sha }}';
- const shortSha = sha.substring(0, 7);
- const repo = '${{ github.repository }}';
- const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
- const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
-
- const append = `---
- ### โ Netlify Deployment Not Found
- (Update logged at: ${updateIST} IST | Commit: ${commitLink})
-
- - **Status:** Deployment Not Found
- - **GitHub Actions Job:** [View Job Log](${jobUrl})
-
- The workflow could not find a matching deployment on Netlify for commit ${commitLink} after 10 attempts.
- No other active builds for this branch were found.
-
- **Next steps:**
- 1. Check the [Netlify dashboard](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys) to see if the build was triggered.
- 2. If needed, re-trigger with a new \`netlify build\` comment.`;
-
- const body = `${existing.data.body}\n\n${append}`;
- await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
-
- console.log('โ Not found comment posted');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- name: Monitor Deployment Status
- if: steps.poll_netlify.outputs.status == 'found'
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -509,9 +416,7 @@ jobs:
MAX_WAIT_TIME=1800
POLL_INTERVAL=90
ELAPSED_TIME=0
-
- # This step now only runs if a deploy_id was found.
- # The 'USE_FALLBACK' logic is no longer needed.
+ USE_FALLBACK=false
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "๐ DEPLOYMENT STATUS MONITORING"
@@ -526,6 +431,12 @@ jobs:
echo " ๐ Started (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+ echo ""
+ echo "โ ๏ธ WARNING: No Deploy ID found. Using branch-based fallback."
+ USE_FALLBACK=true
+ fi
+
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ POLLING DEPLOYMENT STATUS โ"
@@ -541,15 +452,30 @@ jobs:
echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
+ if [ "$USE_FALLBACK" = "true" ]; then
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
+
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+ else
+ DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
+ fi
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
STATE=$(echo "$DEPLOY" | jq -r '.state')
+ CURRENT_DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
+
BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
+ if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
+ DEPLOY_ID=$CURRENT_DEPLOY_ID
+ echo " ๐ Deployment ID: $DEPLOY_ID"
+ fi
+
echo " ๐ Current State: $STATE"
if [ "$STATE" = "ready" ]; then
@@ -613,7 +539,7 @@ jobs:
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- name: Update PR Comment (Success)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'success'
+ if: steps.check_status.outputs.status == 'success'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -649,7 +575,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Failure)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure'
+ if: steps.check_status.outputs.status == 'failure'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -681,8 +607,7 @@ jobs:
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- **GitHub Actions Job:** [View Job Log](${jobUrl})
- - **Error Message:**
- \`\`\`
+ - **Error Message:** \`\`\`
${errorMessage}
\`\`\`
@@ -704,7 +629,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Timeout)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'timeout'
+ if: steps.check_status.outputs.status == 'timeout'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -715,7 +640,7 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
const repo = '${{ github.repository }}';
@@ -743,7 +668,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Fail workflow on deployment failure
- if: (steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure') || steps.poll_netlify.outputs.status == 'not_found'
+ if: steps.check_status.outputs.status == 'failure'
run: |
- echo "::error::Netlify deployment failed or was not found. This PR should not be merged."
+ echo "::error::Netlify deployment failed. This PR should not be merged."
exit 1
\ No newline at end of file
From 62c2af49367a3f5bc15e15d63bbcbdac06dd34f0 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:58:37 +0530
Subject: [PATCH 26/43] chore: concurrency test v2
---
.../workflows/final-manual-deploy-comment.yml | 272 ++++++++++++------
1 file changed, 192 insertions(+), 80 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index afa558c722b..aa8866947b6 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -129,15 +129,14 @@ jobs:
- name: Initialize Dependencies
uses: dcarbone/install-jq-action@v2
- - name: Trigger Netlify Deployment
- id: netlify_build
+ - name: Get PR Info
+ id: get_pr_info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "๐ NETLIFY DEPLOYMENT TRIGGER"
+ echo "โน๏ธ GETTING PR INFO"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-
gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
@@ -148,6 +147,126 @@ jobs:
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
echo "sha=$sha" >> $GITHUB_OUTPUT
+ echo " ๐ Branch: $branch_name"
+ echo " ๐ข PR #: $pr_number"
+ echo " ๐ Commit: $sha"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ - name: Check for Concurrent Builds
+ id: check_builds
+ env:
+ NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+ run: |
+ BRANCH_NAME="${{ steps.get_pr_info.outputs.branch_name }}"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ CHECKING FOR CONCURRENT BUILDS ON BRANCH: $BRANCH_NAME"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "โณ Waiting 30 seconds for Netlify to initialise before fetching deployments..."
+ sleep 30
+
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
+
+ ACTIVE_DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch and (.state == "building" or .state == "enqueued" or .state == "processing"))] |
+ sort_by(.created_at) | reverse | .[0]')
+
+ if [ "$ACTIVE_DEPLOY" != "null" ] && [ -n "$ACTIVE_DEPLOY" ]; then
+ ACTIVE_DEPLOY_ID=$(echo "$ACTIVE_DEPLOY" | jq -r '.id')
+ ACTIVE_COMMIT_SHA=$(echo "$ACTIVE_DEPLOY" | jq -r '.commit_ref // .head')
+ ACTIVE_BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$ACTIVE_DEPLOY_ID"
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ ๏ธ CONCURRENT BUILD DETECTED โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "Another build is already in progress for this branch."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Active Deploy ID: $ACTIVE_DEPLOY_ID"
+ echo " ๐ Active Commit: $ACTIVE_COMMIT_SHA"
+ echo " ๐ Active Build URL: $ACTIVE_BUILD_URL"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ echo "is_active=true" >> $GITHUB_OUTPUT
+ echo "active_deploy_id=$ACTIVE_DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "active_commit_sha=$ACTIVE_COMMIT_SHA" >> $GITHUB_OUTPUT
+ echo "active_build_url=$ACTIVE_BUILD_URL" >> $GITHUB_OUTPUT
+ else
+ echo ""
+ echo "โ
No concurrent builds found. Proceeding."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "is_active=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Post Concurrent Build Comment and Halt
+ if: steps.check_builds.outputs.is_active == 'true'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ ๏ธ Posting concurrent build comment and halting...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const prNumber = '${{ steps.get_pr_info.outputs.pr_number }}';
+ const sha = '${{ steps.get_pr_info.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+
+ const activeSha = '${{ steps.check_builds.outputs.active_commit_sha }}';
+ const activeShortSha = activeSha ? activeSha.substring(0, 7) : 'unknown';
+ const activeCommitLink = activeSha ? `[\`${activeShortSha}\`](https://github.com/${repo}/commit/${activeSha})` : '`unknown`';
+ const activeBuildUrl = '${{ steps.check_builds.outputs.active_build_url }}';
+
+ const body = `### โ ๏ธ Netlify Deployment Halted
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
+
+ - **Status:** Concurrent build detected.
+ - **This Workflow (for commit ${commitLink}):** Halted.
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
+
+ Another build for this branch is already in progress on Netlify.
+ - **In-Progress Commit:** ${activeCommitLink}
+ - **In-Progress Netlify Log:** [View Active Deployment](${activeBuildUrl})
+
+ Please wait for the active build to complete. If you need to build this commit, please trigger a new build *after* the other one has finished.`;
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: Number(prNumber),
+ body
+ });
+
+ console.log('โ ๏ธ Concurrent build comment posted');
+ core.setFailed("Concurrent build detected. Halting workflow.");
+
+ - name: Trigger Netlify Deployment
+ if: steps.check_builds.outputs.is_active == 'false'
+ id: netlify_build
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ NETLIFY DEPLOYMENT TRIGGER"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ # Variables are now from the 'get_pr_info' step
+ branch_name="${{ steps.get_pr_info.outputs.branch_name }}"
+ sha="${{ steps.get_pr_info.outputs.sha }}"
+ pr_number="${{ steps.get_pr_info.outputs.pr_number }}"
+
+ # We still need to output these for subsequent steps
+ echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+ echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
+ echo "sha=$sha" >> $GITHUB_OUTPUT
+
TRIGGER_TIME=$(date -u +%s)
echo "trigger_time=$TRIGGER_TIME" >> $GITHUB_OUTPUT
@@ -157,7 +276,7 @@ jobs:
echo " ๐ Branch: $branch_name"
echo " ๐ข PR #: $pr_number"
echo " ๐ Commit: $sha"
- echo " ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
+ echo " ๐ Time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo ""
@@ -170,6 +289,7 @@ jobs:
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- name: Sanitize branch name for Netlify URL
+ if: steps.check_builds.outputs.is_active == 'false'
id: sanitize_branch
run: |
# Replace all non-alphanumeric characters with '-' and convert to lowercase
@@ -177,6 +297,7 @@ jobs:
echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- name: Create PR Status Comment
+ if: steps.check_builds.outputs.is_active == 'false'
id: initial_comment
uses: actions/github-script@v7
with:
@@ -219,6 +340,7 @@ jobs:
core.setOutput('comment_id', comment.id);
- name: Locate Netlify Deployment
+ if: steps.check_builds.outputs.is_active == 'false'
id: poll_netlify
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -296,7 +418,9 @@ jobs:
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
- break
+
+ echo "status=found" >> $GITHUB_OUTPUT
+ exit 0 # Exit script successfully
else
echo " โ ๏ธ Found deployment but it's too old (${TIME_DIFF}s offset)"
fi
@@ -307,55 +431,23 @@ jobs:
sleep 15
fi
done
-
- if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+
+ else
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ FALLBACK: SEARCHING BY BRANCH NAME โ"
+ echo "โ โ DEPLOYMENT NOT FOUND โ"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "No deployment could be located for commit $SHA."
+ echo "No other active builds were found on this branch."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
-
- if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
- DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
- CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
- CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
- BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
-
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ
DEPLOYMENT FOUND (BRANCH-BASED) โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "๐ฆ Deployment Information:"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo " ๐ Deploy ID: $DEPLOY_ID"
- echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
- echo " ๐
Created (UTC): $CREATED_AT"
- echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
- echo " โ ๏ธ Method: Branch-based validation (fallback)"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- DEPLOY_FOUND_VIA="branch"
-
- echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
- echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
- echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
- else
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ DEPLOYMENT NOT FOUND โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "No deployment could be located using either method."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- exit 1
- fi
+ echo "status=not_found" >> $GITHUB_OUTPUT
+ exit 0
fi
- name: Update PR Comment (Deployment Found)
- if: steps.poll_netlify.outputs.deploy_id != ''
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_builds.outputs.is_active == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -382,7 +474,7 @@ jobs:
const detailLine = deployFoundVia === 'commit'
? `- **Validation:** Commit-based (${commitLink})`
- : `- **Validation:** Branch-based`;
+ : `- **Validation:** Branch-based`; // This line should not be hit based on new logic, but safe to keep
const append = `---
### โณ Netlify Deployment In Progress
@@ -403,7 +495,48 @@ jobs:
console.log('โ
PR comment updated successfully');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ - name: Update PR Comment (Not Found)
+ if: steps.poll_netlify.outputs.status == 'not_found' && steps.check_builds.outputs.is_active == 'false'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+ console.log('โ Updating PR comment with deployment not found status...');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
+ const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
+ const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const sha = '${{ steps.netlify_build.outputs.sha }}';
+ const shortSha = sha.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
+ const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
+
+ const append = `---
+ ### โ Netlify Deployment Not Found
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
+
+ - **Status:** Deployment Not Found
+ - **GitHub Actions Job:** [View Job Log](${jobUrl})
+
+ The workflow could not find a matching deployment on Netlify for commit ${commitLink} after 10 attempts.
+ No other active builds for this branch were found.
+
+ **Next steps:**
+ 1. Check the [Netlify dashboard](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys) to see if the build was triggered.
+ 2. If needed, re-trigger with a new \`netlify build\` comment.`;
+
+ const body = `${existing.data.body}\n\n${append}`;
+ await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
+
+ console.log('โ Not found comment posted');
+ console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
+
- name: Monitor Deployment Status
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_builds.outputs.is_active == 'false'
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -416,7 +549,6 @@ jobs:
MAX_WAIT_TIME=1800
POLL_INTERVAL=90
ELAPSED_TIME=0
- USE_FALLBACK=false
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "๐ DEPLOYMENT STATUS MONITORING"
@@ -431,12 +563,6 @@ jobs:
echo " ๐ Started (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
- echo ""
- echo "โ ๏ธ WARNING: No Deploy ID found. Using branch-based fallback."
- USE_FALLBACK=true
- fi
-
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ POLLING DEPLOYMENT STATUS โ"
@@ -452,30 +578,15 @@ jobs:
echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- if [ "$USE_FALLBACK" = "true" ]; then
- DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
-
- DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
- else
- DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
- fi
+ DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
STATE=$(echo "$DEPLOY" | jq -r '.state')
- CURRENT_DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
-
BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
- if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
- DEPLOY_ID=$CURRENT_DEPLOY_ID
- echo " ๐ Deployment ID: $DEPLOY_ID"
- fi
-
echo " ๐ Current State: $STATE"
if [ "$STATE" = "ready" ]; then
@@ -539,7 +650,7 @@ jobs:
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- name: Update PR Comment (Success)
- if: steps.check_status.outputs.status == 'success'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'success' && steps.check_builds.outputs.is_active == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -575,7 +686,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Failure)
- if: steps.check_status.outputs.status == 'failure'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure' && steps.check_builds.outputs.is_active == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -607,7 +718,8 @@ jobs:
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- **GitHub Actions Job:** [View Job Log](${jobUrl})
- - **Error Message:** \`\`\`
+ - **Error Message:**
+ \`\`\`
${errorMessage}
\`\`\`
@@ -629,7 +741,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Timeout)
- if: steps.check_status.outputs.status == 'timeout'
+ if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'timeout' && steps.check_builds.outputs.is_active == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -640,7 +752,7 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
const repo = '${{ github.repository }}';
@@ -668,7 +780,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Fail workflow on deployment failure
- if: steps.check_status.outputs.status == 'failure'
+ if: ((steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure') || steps.poll_netlify.outputs.status == 'not_found') && steps.check_builds.outputs.is_active == 'false'
run: |
- echo "::error::Netlify deployment failed. This PR should not be merged."
+ echo "::error::Netlify deployment failed or was not found. This PR should not be merged."
exit 1
\ No newline at end of file
From 4695fab4febec0292f11f0c32cda8917a3653ce4 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 00:59:10 +0530
Subject: [PATCH 27/43] chore: concurrency test v2, trigger concurrency now
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index f1740a9aff5..e48c12e63cc 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-31'
+releaseDate: '2025-06-30'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From f57bf80368bb11ed3e0b24d2ca1f139a3a71f5cf Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 01:04:48 +0530
Subject: [PATCH 28/43] chore: revert concurrency strategy v2
This reverts commit 4695fab4febec0292f11f0c32cda8917a3653ce4.
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index e48c12e63cc..f1740a9aff5 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-30'
+releaseDate: '2025-06-31'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From a5076270968ffe1f873fd948eb5575fb8154bb85 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Mon, 10 Nov 2025 01:05:11 +0530
Subject: [PATCH 29/43] chore: revert concurrency strategy v2 This reverts
commit 62c2af49367a3f5bc15e15d63bbcbdac06dd34f0.
---
.../workflows/final-manual-deploy-comment.yml | 272 ++++++------------
1 file changed, 80 insertions(+), 192 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index aa8866947b6..afa558c722b 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -129,14 +129,15 @@ jobs:
- name: Initialize Dependencies
uses: dcarbone/install-jq-action@v2
- - name: Get PR Info
- id: get_pr_info
+ - name: Trigger Netlify Deployment
+ id: netlify_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โน๏ธ GETTING PR INFO"
+ echo "๐ NETLIFY DEPLOYMENT TRIGGER"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
@@ -147,126 +148,6 @@ jobs:
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
echo "sha=$sha" >> $GITHUB_OUTPUT
- echo " ๐ Branch: $branch_name"
- echo " ๐ข PR #: $pr_number"
- echo " ๐ Commit: $sha"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-
- - name: Check for Concurrent Builds
- id: check_builds
- env:
- NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- run: |
- BRANCH_NAME="${{ steps.get_pr_info.outputs.branch_name }}"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "๐ CHECKING FOR CONCURRENT BUILDS ON BRANCH: $BRANCH_NAME"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "โณ Waiting 30 seconds for Netlify to initialise before fetching deployments..."
- sleep 30
-
- DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
-
- ACTIVE_DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
- '[.[] | select(.branch == $branch and (.state == "building" or .state == "enqueued" or .state == "processing"))] |
- sort_by(.created_at) | reverse | .[0]')
-
- if [ "$ACTIVE_DEPLOY" != "null" ] && [ -n "$ACTIVE_DEPLOY" ]; then
- ACTIVE_DEPLOY_ID=$(echo "$ACTIVE_DEPLOY" | jq -r '.id')
- ACTIVE_COMMIT_SHA=$(echo "$ACTIVE_DEPLOY" | jq -r '.commit_ref // .head')
- ACTIVE_BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$ACTIVE_DEPLOY_ID"
-
- echo ""
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ ๏ธ CONCURRENT BUILD DETECTED โ"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "Another build is already in progress for this branch."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo " ๐ Active Deploy ID: $ACTIVE_DEPLOY_ID"
- echo " ๐ Active Commit: $ACTIVE_COMMIT_SHA"
- echo " ๐ Active Build URL: $ACTIVE_BUILD_URL"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-
- echo "is_active=true" >> $GITHUB_OUTPUT
- echo "active_deploy_id=$ACTIVE_DEPLOY_ID" >> $GITHUB_OUTPUT
- echo "active_commit_sha=$ACTIVE_COMMIT_SHA" >> $GITHUB_OUTPUT
- echo "active_build_url=$ACTIVE_BUILD_URL" >> $GITHUB_OUTPUT
- else
- echo ""
- echo "โ
No concurrent builds found. Proceeding."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "is_active=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Post Concurrent Build Comment and Halt
- if: steps.check_builds.outputs.is_active == 'true'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- console.log('โ ๏ธ Posting concurrent build comment and halting...');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const prNumber = '${{ steps.get_pr_info.outputs.pr_number }}';
- const sha = '${{ steps.get_pr_info.outputs.sha }}';
- const shortSha = sha.substring(0, 7);
- const repo = '${{ github.repository }}';
- const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
- const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
-
- const activeSha = '${{ steps.check_builds.outputs.active_commit_sha }}';
- const activeShortSha = activeSha ? activeSha.substring(0, 7) : 'unknown';
- const activeCommitLink = activeSha ? `[\`${activeShortSha}\`](https://github.com/${repo}/commit/${activeSha})` : '`unknown`';
- const activeBuildUrl = '${{ steps.check_builds.outputs.active_build_url }}';
-
- const body = `### โ ๏ธ Netlify Deployment Halted
- (Update logged at: ${updateIST} IST | Commit: ${commitLink})
-
- - **Status:** Concurrent build detected.
- - **This Workflow (for commit ${commitLink}):** Halted.
- - **GitHub Actions Job:** [View Job Log](${jobUrl})
-
- Another build for this branch is already in progress on Netlify.
- - **In-Progress Commit:** ${activeCommitLink}
- - **In-Progress Netlify Log:** [View Active Deployment](${activeBuildUrl})
-
- Please wait for the active build to complete. If you need to build this commit, please trigger a new build *after* the other one has finished.`;
-
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: Number(prNumber),
- body
- });
-
- console.log('โ ๏ธ Concurrent build comment posted');
- core.setFailed("Concurrent build detected. Halting workflow.");
-
- - name: Trigger Netlify Deployment
- if: steps.check_builds.outputs.is_active == 'false'
- id: netlify_build
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "๐ NETLIFY DEPLOYMENT TRIGGER"
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-
- # Variables are now from the 'get_pr_info' step
- branch_name="${{ steps.get_pr_info.outputs.branch_name }}"
- sha="${{ steps.get_pr_info.outputs.sha }}"
- pr_number="${{ steps.get_pr_info.outputs.pr_number }}"
-
- # We still need to output these for subsequent steps
- echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
- echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
- echo "sha=$sha" >> $GITHUB_OUTPUT
-
TRIGGER_TIME=$(date -u +%s)
echo "trigger_time=$TRIGGER_TIME" >> $GITHUB_OUTPUT
@@ -276,7 +157,7 @@ jobs:
echo " ๐ Branch: $branch_name"
echo " ๐ข PR #: $pr_number"
echo " ๐ Commit: $sha"
- echo " ๐ Time (IST): $(TZ=Asia/Kolkata date -d @$TRIGGER_TIME '+%Y-%m-%d %H:%M:%S')"
+ echo " ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo ""
@@ -289,7 +170,6 @@ jobs:
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- name: Sanitize branch name for Netlify URL
- if: steps.check_builds.outputs.is_active == 'false'
id: sanitize_branch
run: |
# Replace all non-alphanumeric characters with '-' and convert to lowercase
@@ -297,7 +177,6 @@ jobs:
echo "name=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- name: Create PR Status Comment
- if: steps.check_builds.outputs.is_active == 'false'
id: initial_comment
uses: actions/github-script@v7
with:
@@ -340,7 +219,6 @@ jobs:
core.setOutput('comment_id', comment.id);
- name: Locate Netlify Deployment
- if: steps.check_builds.outputs.is_active == 'false'
id: poll_netlify
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -418,9 +296,7 @@ jobs:
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
-
- echo "status=found" >> $GITHUB_OUTPUT
- exit 0 # Exit script successfully
+ break
else
echo " โ ๏ธ Found deployment but it's too old (${TIME_DIFF}s offset)"
fi
@@ -431,23 +307,55 @@ jobs:
sleep 15
fi
done
-
- else
+
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "โ โ DEPLOYMENT NOT FOUND โ"
+ echo "โ FALLBACK: SEARCHING BY BRANCH NAME โ"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo ""
- echo "No deployment could be located for commit $SHA."
- echo "No other active builds were found on this branch."
- echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- echo "status=not_found" >> $GITHUB_OUTPUT
- exit 0
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+
+ if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
+ DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
+ CREATED_AT=$(echo "$DEPLOY" | jq -r '.created_at')
+ CREATED_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "$CREATED_AT" +%s 2>/dev/null || echo "$TRIGGER_TIME")
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ
DEPLOYMENT FOUND (BRANCH-BASED) โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "๐ฆ Deployment Information:"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo " ๐ Deploy ID: $DEPLOY_ID"
+ echo " ๐ Build URL: Obfuscated, check updated build status in the PR comment"
+ echo " ๐
Created (UTC): $CREATED_AT"
+ echo " ๐
Created (IST): $(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S')"
+ echo " โ ๏ธ Method: Branch-based validation (fallback)"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ DEPLOY_FOUND_VIA="branch"
+
+ echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "deploy_found_via=$DEPLOY_FOUND_VIA" >> $GITHUB_OUTPUT
+ echo "created_at_ist=$(TZ=Asia/Kolkata date -d @$CREATED_TIMESTAMP '+%Y-%m-%d %H:%M:%S IST')" >> $GITHUB_OUTPUT
+ else
+ echo ""
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "โ โ DEPLOYMENT NOT FOUND โ"
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo ""
+ echo "No deployment could be located using either method."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ exit 1
+ fi
fi
- name: Update PR Comment (Deployment Found)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_builds.outputs.is_active == 'false'
+ if: steps.poll_netlify.outputs.deploy_id != ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -474,7 +382,7 @@ jobs:
const detailLine = deployFoundVia === 'commit'
? `- **Validation:** Commit-based (${commitLink})`
- : `- **Validation:** Branch-based`; // This line should not be hit based on new logic, but safe to keep
+ : `- **Validation:** Branch-based`;
const append = `---
### โณ Netlify Deployment In Progress
@@ -495,48 +403,7 @@ jobs:
console.log('โ
PR comment updated successfully');
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- - name: Update PR Comment (Not Found)
- if: steps.poll_netlify.outputs.status == 'not_found' && steps.check_builds.outputs.is_active == 'false'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- console.log('โ Updating PR comment with deployment not found status...');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
- const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
- const sha = '${{ steps.netlify_build.outputs.sha }}';
- const shortSha = sha.substring(0, 7);
- const repo = '${{ github.repository }}';
- const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
- const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
-
- const append = `---
- ### โ Netlify Deployment Not Found
- (Update logged at: ${updateIST} IST | Commit: ${commitLink})
-
- - **Status:** Deployment Not Found
- - **GitHub Actions Job:** [View Job Log](${jobUrl})
-
- The workflow could not find a matching deployment on Netlify for commit ${commitLink} after 10 attempts.
- No other active builds for this branch were found.
-
- **Next steps:**
- 1. Check the [Netlify dashboard](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys) to see if the build was triggered.
- 2. If needed, re-trigger with a new \`netlify build\` comment.`;
-
- const body = `${existing.data.body}\n\n${append}`;
- await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, body });
-
- console.log('โ Not found comment posted');
- console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
-
- name: Monitor Deployment Status
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_builds.outputs.is_active == 'false'
id: check_status
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -549,6 +416,7 @@ jobs:
MAX_WAIT_TIME=1800
POLL_INTERVAL=90
ELAPSED_TIME=0
+ USE_FALLBACK=false
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "๐ DEPLOYMENT STATUS MONITORING"
@@ -563,6 +431,12 @@ jobs:
echo " ๐ Started (IST): $(TZ=Asia/Kolkata date -d @${{ steps.netlify_build.outputs.trigger_time }} '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ if [ -z "$DEPLOY_ID" ] || [ "$DEPLOY_ID" = "null" ]; then
+ echo ""
+ echo "โ ๏ธ WARNING: No Deploy ID found. Using branch-based fallback."
+ USE_FALLBACK=true
+ fi
+
echo ""
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ POLLING DEPLOYMENT STATUS โ"
@@ -578,15 +452,30 @@ jobs:
echo "โ ๐ Time (IST): $(TZ=Asia/Kolkata date '+%Y-%m-%d %H:%M:%S')"
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
- DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
- "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
+ if [ "$USE_FALLBACK" = "true" ]; then
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys")
+
+ DEPLOY=$(echo "$DEPLOYS" | jq -r --arg branch "$BRANCH_NAME" \
+ '[.[] | select(.branch == $branch)] | sort_by(.created_at) | reverse | .[0]')
+ else
+ DEPLOY=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID")
+ fi
if [ "$DEPLOY" != "null" ] && [ -n "$DEPLOY" ]; then
STATE=$(echo "$DEPLOY" | jq -r '.state')
+ CURRENT_DEPLOY_ID=$(echo "$DEPLOY" | jq -r '.id')
DEPLOY_URL=$(echo "$DEPLOY" | jq -r '.deploy_ssl_url // .ssl_url // .url')
ERROR_MESSAGE=$(echo "$DEPLOY" | jq -r '.error_message // ""')
+
BUILD_URL="https://app.netlify.com/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID"
+ if [ "$USE_FALLBACK" = "true" ] && [ -z "$DEPLOY_ID" ]; then
+ DEPLOY_ID=$CURRENT_DEPLOY_ID
+ echo " ๐ Deployment ID: $DEPLOY_ID"
+ fi
+
echo " ๐ Current State: $STATE"
if [ "$STATE" = "ready" ]; then
@@ -650,7 +539,7 @@ jobs:
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
- name: Update PR Comment (Success)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'success' && steps.check_builds.outputs.is_active == 'false'
+ if: steps.check_status.outputs.status == 'success'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -686,7 +575,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Failure)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure' && steps.check_builds.outputs.is_active == 'false'
+ if: steps.check_status.outputs.status == 'failure'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -718,8 +607,7 @@ jobs:
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- **GitHub Actions Job:** [View Job Log](${jobUrl})
- - **Error Message:**
- \`\`\`
+ - **Error Message:** \`\`\`
${errorMessage}
\`\`\`
@@ -741,7 +629,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Update PR Comment (Timeout)
- if: steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'timeout' && steps.check_builds.outputs.is_active == 'false'
+ if: steps.check_status.outputs.status == 'timeout'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -752,7 +640,7 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
const repo = '${{ github.repository }}';
@@ -780,7 +668,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
- name: Fail workflow on deployment failure
- if: ((steps.poll_netlify.outputs.status == 'found' && steps.check_status.outputs.status == 'failure') || steps.poll_netlify.outputs.status == 'not_found') && steps.check_builds.outputs.is_active == 'false'
+ if: steps.check_status.outputs.status == 'failure'
run: |
- echo "::error::Netlify deployment failed or was not found. This PR should not be merged."
+ echo "::error::Netlify deployment failed. This PR should not be merged."
exit 1
\ No newline at end of file
From 8eb5dbf98aeb135f484772be9cc4238329b1dcba Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:04:32 +0530
Subject: [PATCH 30/43] chore: revisit running deploy block mechanism
---
.../workflows/final-manual-deploy-comment.yml | 87 ++++++++++++++++++-
1 file changed, 85 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index afa558c722b..f32618da3c8 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -129,7 +129,90 @@ jobs:
- name: Initialize Dependencies
uses: dcarbone/install-jq-action@v2
+ - name: Check for Ongoing Deployments
+ id: check_ongoing_deployment
+ env:
+ NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+ echo "๐ Checking for existing Netlify deployments..."
+ echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
+
+ gh_api_url=$(echo ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} | sed 's/https:\/\/api.github.com\///')
+ gh_api_response=$(gh api $gh_api_url)
+ branch_name=$(echo $gh_api_response | jq -r .head.ref)
+ pr_number=$(echo $gh_api_response | jq -r .number)
+
+ echo " ๐ Branch: $branch_name"
+
+ DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
+ "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys?branch=$branch_name")
+
+ ONGOING_DEPLOY=$(echo "$DEPLOYS" | jq -r \
+ '[.[] | select(.state == "building" or .state == "enqueued" or .state == "processing")] | sort_by(.created_at) | reverse | .[0]')
+
+ if [ -n "$ONGOING_DEPLOY" ] && [ "$ONGOING_DEPLOY" != "null" ]; then
+ DEPLOY_ID=$(echo "$ONGOING_DEPLOY" | jq -r '.id')
+ COMMIT_REF=$(echo "$ONGOING_DEPLOY" | jq -r '.commit_ref')
+ BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
+
+ echo "ongoing_deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
+ echo "ongoing_commit_ref=$COMMIT_REF" >> $GITHUB_OUTPUT
+ echo "ongoing_build_url=$BUILD_URL" >> $GITHUB_OUTPUT
+ echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
+
+ echo ""
+ echo "๐ Found an ongoing deployment: $DEPLOY_ID"
+ echo " Commit: $COMMIT_REF"
+ echo " Halting workflow."
+ exit 0
+ else
+ echo "โ
No ongoing deployments found for this branch."
+ fi
+
+ - name: Post Comment for Ongoing Deployment
+ if: steps.check_ongoing_deployment.outputs.ongoing_deploy_id
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const prNumber = '${{ steps.check_ongoing_deployment.outputs.pr_number }}';
+ const deployId = '${{ steps.check_ongoing_deployment.outputs.ongoing_deploy_id }}';
+ const commitRef = '${{ steps.check_ongoing_deployment.outputs.ongoing_commit_ref }}';
+ const buildUrl = '${{ steps.check_ongoing_deployment.outputs.ongoing_build_url }}';
+ const shortCommit = commitRef.substring(0, 7);
+ const repo = '${{ github.repository }}';
+ const commitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
+
+ const body = `### โณ A Netlify Deployment is Already in Progress
+
+ An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.
+
+ - **Ongoing Deploy ID:** \`${deployId}\`
+ - **Triggered by Commit:** ${commitLink}
+ - **Monitor Progress:** [View Deployment](${buildUrl})
+
+ Once the previous deployment is finished, you can trigger a new build by commenting \`netlify build\` on this PR.`;
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: Number(prNumber),
+ body
+ });
+
+ console.log('โ
Commented on PR about the ongoing deployment.');
+
+ - name: Stop Workflow if Deployment is Ongoing
+ if: steps.check_ongoing_deployment.outputs.ongoing_deploy_id
+ run: |
+ echo "๐ Workflow stopped because an existing deployment is in progress."
+ exit 1
+
- name: Trigger Netlify Deployment
+ if: ${{ !steps.check_ongoing_deployment.outputs.ongoing_deploy_id }}
id: netlify_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -607,9 +690,9 @@ jobs:
- **Deploy ID:** \`${{ steps.check_status.outputs.deploy_id }}\`
- **Netlify Deployment:** [View Deployment Log](https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/${{ steps.check_status.outputs.deploy_id }})
- **GitHub Actions Job:** [View Job Log](${jobUrl})
- - **Error Message:** \`\`\`
+ - **Error Message:**
+
${errorMessage}
- \`\`\`
### ๐ ๏ธ Required Actions:
1. **Review the error message and Netlify log carefully.**
From 924ea4577a0f560f084493baf3661b66ad5e7532 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:16:03 +0530
Subject: [PATCH 31/43] chore: revert failure case
---
.../whats-new/2025/06/whats-new-06-31-dash-nested-variables.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
index f1740a9aff5..e48c12e63cc 100644
--- a/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
+++ b/src/content/whats-new/2025/06/whats-new-06-31-dash-nested-variables.md
@@ -1,7 +1,7 @@
---
title: 'Nested Variables for Dashboards'
summary: 'Enhance your dashboard filtering with our new Nested Variables, creating a more dynamic and interactive experience!'
-releaseDate: '2025-06-31'
+releaseDate: '2025-06-30'
learnMoreLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/nested-variables/'
getStartedLink: 'https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/dashboard-template-variables/'
---
From 50fa9d3546bbced6d8129046cdf4664c140557ea Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:33:07 +0530
Subject: [PATCH 32/43] chore: small scale cosmetic fixes to dates
---
.github/workflows/final-manual-deploy-comment.yml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index f32618da3c8..2d1ae242981 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -185,8 +185,10 @@ jobs:
const shortCommit = commitRef.substring(0, 7);
const repo = '${{ github.repository }}';
const commitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
const body = `### โณ A Netlify Deployment is Already in Progress
+ (Update logged at: ${updateIST} IST | Commit: ${commitLink})
An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.
@@ -270,7 +272,7 @@ jobs:
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ');
const triggerEpoch = Number('${{ steps.netlify_build.outputs.trigger_time }}') * 1000;
- const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const triggeredAtIST = new Date(triggerEpoch).toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
const prNumber = '${{ steps.netlify_build.outputs.pr_number }}';
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
@@ -461,7 +463,7 @@ jobs:
const commitLink = `[\`${shortSha}\`](https://github.com/${repo}/commit/${sha})`;
const jobUrl = `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
const deployId = '${{ steps.poll_netlify.outputs.deploy_id }}';
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
const detailLine = deployFoundVia === 'commit'
? `- **Validation:** Commit-based (${commitLink})`
@@ -723,7 +725,7 @@ jobs:
const commentId = Number('${{ steps.initial_comment.outputs.comment_id }}');
const existing = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId });
- const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/KKolkata', hour12: false });
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
const sha = '${{ steps.netlify_build.outputs.sha }}';
const shortSha = sha.substring(0, 7);
const repo = '${{ github.repository }}';
From e611b726392e80ad2ca4702f11cfa97305f11b97 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:38:47 +0530
Subject: [PATCH 33/43] chore: small scale cosmetic fixes
---
.github/workflows/final-manual-deploy-comment.yml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 2d1ae242981..2a48690c4b6 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -144,7 +144,9 @@ jobs:
gh_api_response=$(gh api $gh_api_url)
branch_name=$(echo $gh_api_response | jq -r .head.ref)
pr_number=$(echo $gh_api_response | jq -r .number)
+ latest_sha=$(echo $gh_api_response | jq -r .head.sha)
+ echo "latest_sha=$latest_sha" >> $GITHUB_OUTPUT
echo " ๐ Branch: $branch_name"
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_TOKEN" \
@@ -184,16 +186,20 @@ jobs:
const buildUrl = '${{ steps.check_ongoing_deployment.outputs.ongoing_build_url }}';
const shortCommit = commitRef.substring(0, 7);
const repo = '${{ github.repository }}';
- const commitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
+ const ongoingCommitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
+ const latestSha = '${{ steps.check_ongoing_deployment.outputs.latest_sha }}';
+ const shortLatestSha = latestSha.substring(0, 7);
+ const latestCommitLink = `[\`${shortLatestSha}\`](https://github.com/${repo}/commit/${latestSha})`;
+
const body = `### โณ A Netlify Deployment is Already in Progress
- (Update logged at: ${updateIST} IST | Commit: ${commitLink})
+ (Update logged at: ${updateIST} IST | Commit: ${latestCommitLink})
An existing deployment for this branch is currently running. Please wait for it to complete before starting a new one.
- **Ongoing Deploy ID:** \`${deployId}\`
- - **Triggered by Commit:** ${commitLink}
+ - **Triggered by Commit:** ${ongoingCommitLink}
- **Monitor Progress:** [View Deployment](${buildUrl})
Once the previous deployment is finished, you can trigger a new build by commenting \`netlify build\` on this PR.`;
From af94944cf1b951f5af965725ad5cf1f17edf9a92 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:41:16 +0530
Subject: [PATCH 34/43] chore: empty commit test #1
From 37e0d0974d0547ee8a41000168441479bb0eefc9 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 00:42:16 +0530
Subject: [PATCH 35/43] chore: empty commit test, expect no new deployment
From e8fb94433005d91d0e5559e6b762b123e43b4a59 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:05:06 +0530
Subject: [PATCH 36/43] chore: test commit to tigger deployment
---
.github/workflows/final-manual-deploy-comment.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 2a48690c4b6..97a14c5c006 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -189,7 +189,7 @@ jobs:
const ongoingCommitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
- const latestSha = '${{ steps.check_ongoing_deployment.outputs.latest_sha }}';
+ const latestSha = '${{ github.event.comment.commit_id || github.event.pull_request.head.sha || github.sha }}';
const shortLatestSha = latestSha.substring(0, 7);
const latestCommitLink = `[\`${shortLatestSha}\`](https://github.com/${repo}/commit/${latestSha})`;
From 50a51e8ca52e3b7a0337a14f05d31e7cfb27daf2 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:06:05 +0530
Subject: [PATCH 37/43] chore: empty commit to induce ongoing deploy comment
From c901d115f4fc92fabbb95d5a9a2d679f8b61403d Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:09:29 +0530
Subject: [PATCH 38/43] chore: changes to try validating the comment again
---
.github/workflows/final-manual-deploy-comment.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 97a14c5c006..2a48690c4b6 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -189,7 +189,7 @@ jobs:
const ongoingCommitLink = `[\`${shortCommit}\`](https://github.com/${repo}/commit/${commitRef})`;
const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
- const latestSha = '${{ github.event.comment.commit_id || github.event.pull_request.head.sha || github.sha }}';
+ const latestSha = '${{ steps.check_ongoing_deployment.outputs.latest_sha }}';
const shortLatestSha = latestSha.substring(0, 7);
const latestCommitLink = `[\`${shortLatestSha}\`](https://github.com/${repo}/commit/${latestSha})`;
From e5d6296d2b6fef16b856f6b1b9f34726d84338b3 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:15:30 +0530
Subject: [PATCH 39/43] chore: commit to trigger deploy
---
.github/workflows/final-manual-deploy-comment.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 2a48690c4b6..760996c6834 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -157,7 +157,7 @@ jobs:
if [ -n "$ONGOING_DEPLOY" ] && [ "$ONGOING_DEPLOY" != "null" ]; then
DEPLOY_ID=$(echo "$ONGOING_DEPLOY" | jq -r '.id')
- COMMIT_REF=$(echo "$ONGOING_DEPLOY" | jq -r '.commit_ref')
+ COMMIT_REF=$(echo "$ONGOING_DEPLOY" | jq -r '.commit_ref // .head')
BUILD_URL="https://app.netlify.com/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys/$DEPLOY_ID"
echo "ongoing_deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
From ecac756980f760592ea157bb2e40846730448172 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:17:04 +0530
Subject: [PATCH 40/43] chore: empty commit to induce ongoing deploy comment
From bffdc3b12acd1f874cfc4750d00215d9e23456a5 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:17:43 +0530
Subject: [PATCH 41/43] chore: empty commit to induce ongoing deploy comment
From ec0f92e595004476158f97102fc618468b6221bf Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 01:27:57 +0530
Subject: [PATCH 42/43] chore: final set of changes to validate tokens when
they expire
---
.../workflows/final-manual-deploy-comment.yml | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index 760996c6834..ed1e5ffcd7a 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -129,6 +129,56 @@ jobs:
- name: Initialize Dependencies
uses: dcarbone/install-jq-action@v2
+ - name: Validate Netlify Credentials
+ id: validate_netlify_token
+ env:
+ NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
+ run: |
+ echo "๐งช Validating Netlify API token..."
+ http_status=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $NETLIFY_TOKEN" https://api.netlify.com/api/v1/user)
+
+ if [ "$http_status" -eq 401 ]; then
+ echo "::error::Netlify API token is invalid or has expired."
+ echo "is_invalid=true" >> $GITHUB_OUTPUT
+ else
+ echo "โ
Netlify API token is valid."
+ echo "is_invalid=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Post Comment for Invalid Token
+ if: steps.validate_netlify_token.outputs.is_invalid == 'true'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const prUrl = '${{ github.event.issue.pull_request.url || github.event.pull_request.url }}';
+ const prNumber = prUrl.split('/').pop();
+ const updateIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata', hourCycle: 'h23' });
+
+ const body = `### ๐จ Action Required: Netlify API Token Expired
+ (Logged at: ${updateIST} IST)
+
+ Dear *Docs Engineering* team, the \`NETLIFY_AUTH_TOKEN\` used by this workflow is **invalid or has expired**. All Netlify deployment previews are blocked until a new token is provided.
+
+ **To fix this:**
+ 1. Generate a new Personal Access Token in your Netlify User Settings.
+ 2. Update the \`NETLIFY_AUTH_TOKEN\` repository secret with the new value.
+
+ This workflow will remain blocked until the credentials are updated.`;
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: Number(prNumber),
+ body
+ });
+
+ - name: Halt Workflow for Invalid Token
+ if: steps.validate_netlify_token.outputs.is_invalid == 'true'
+ run: |
+ echo "๐ Halting workflow due to invalid Netlify token."
+ exit 1
+
- name: Check for Ongoing Deployments
id: check_ongoing_deployment
env:
From 2c8bb451047bb75ffb5d028662f4b875ebd246f2 Mon Sep 17 00:00:00 2001
From: pranav-new-relic
Date: Wed, 26 Nov 2025 11:16:47 +0530
Subject: [PATCH 43/43] chore: remove experimental triggers, revert to comment
based
---
.github/workflows/final-manual-deploy-comment.yml | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/final-manual-deploy-comment.yml b/.github/workflows/final-manual-deploy-comment.yml
index ed1e5ffcd7a..29d4546eb81 100644
--- a/.github/workflows/final-manual-deploy-comment.yml
+++ b/.github/workflows/final-manual-deploy-comment.yml
@@ -1,18 +1,12 @@
-name: Final Netlify build manual deploy comment
+name: Final 'Comment' Netlify Build + Build Reportage (Manual Deploy)
on:
issue_comment:
types: [created]
- # This is the new trigger that allows testing from a PR branch
- pull_request:
- types: [opened, synchronize]
jobs:
deploy-preview:
- # This 'if' now runs for the 'netlify build' comment OR any 'pull_request' event
- if: |
- (github.event.comment.body == 'netlify build' && github.event.issue.pull_request)
- || github.event_name == 'pull_request'
+ if: github.event.comment.body == 'netlify build' && github.event.issue.pull_request
runs-on: ubuntu-latest
steps: