Skip to content
Open
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c4089ff
chore: build break test with 31st June
pranav-new-relic Nov 7, 2025
325c207
chore: AI experiment to revamp netlify build comment workflow
pranav-new-relic Nov 7, 2025
bd5807a
chore: try making the workflow more resilient?
pranav-new-relic Nov 7, 2025
7067c95
chore: breaking the infinite loop of build, by splitting build and de…
pranav-new-relic Nov 7, 2025
14f3427
chore: test PR v2, build break test with 31st June: DO NOT MERGE
pranav-new-relic Nov 7, 2025
e8b32c1
chore: optimize workflow?
pranav-new-relic Nov 7, 2025
45f85f9
chore: fix forked member check part of the workflow?
pranav-new-relic Nov 7, 2025
0c499f0
chore: working so good so far, optimize timestamp diff logic
pranav-new-relic Nov 7, 2025
6608308
chore: works as expected, some cosmetic changes
pranav-new-relic Nov 7, 2025
a2f5c11
chore: works as expected, some cosmetic changes, probably final?
pranav-new-relic Nov 7, 2025
e30124a
chore: merge branch 'develop' into np-test-v2
pranav-new-relic Nov 8, 2025
b13e0f1
chore: remove the build failure inducer to test success flow
pranav-new-relic Nov 8, 2025
b804bdf
chore: more cosmetics, timezone changes, informative PR comments
pranav-new-relic Nov 8, 2025
0c3b9ad
chore: tiny fixes
pranav-new-relic Nov 8, 2025
a349995
chore: tiny fixes
pranav-new-relic Nov 8, 2025
178dac1
chore: hopefully cosmetic changes should work now?
pranav-new-relic Nov 8, 2025
48e9c34
chore: hopefully cosmetic changes should work now?
pranav-new-relic Nov 8, 2025
2af0fc9
chore: hopefully cosmetic changes should work now?
pranav-new-relic Nov 8, 2025
c8b24e1
chore: more cosmetic changes
pranav-new-relic Nov 9, 2025
3aa8f44
chore: more cosmetic changes
pranav-new-relic Nov 9, 2025
4e8055f
chore: probably the final set of cosmetic changes to logs
pranav-new-relic Nov 9, 2025
b471f8f
chore: introduce immediate change to test parallel build that will break
pranav-new-relic Nov 9, 2025
00ea5c5
chore: workflow concurrency test 1
pranav-new-relic Nov 9, 2025
a3d6027
chore: workflow concurrency test 1, change to trigger concurrency
pranav-new-relic Nov 9, 2025
21ca8d0
chore: revert concurrency logic, revisit tomorrow
pranav-new-relic Nov 9, 2025
516e1a6
chore: revert concurrency logic, revisit tomorrow
pranav-new-relic Nov 9, 2025
62c2af4
chore: concurrency test v2
pranav-new-relic Nov 9, 2025
4695fab
chore: concurrency test v2, trigger concurrency now
pranav-new-relic Nov 9, 2025
f57bf80
chore: revert concurrency strategy v2
pranav-new-relic Nov 9, 2025
a507627
chore: revert concurrency strategy v2
pranav-new-relic Nov 9, 2025
8eb5dbf
chore: revisit running deploy block mechanism
pranav-new-relic Nov 25, 2025
b96d052
chore: merge branch 'develop' into np-test-v2
pranav-new-relic Nov 25, 2025
924ea45
chore: revert failure case
pranav-new-relic Nov 25, 2025
50fa9d3
chore: small scale cosmetic fixes to dates
pranav-new-relic Nov 25, 2025
e611b72
chore: small scale cosmetic fixes
pranav-new-relic Nov 25, 2025
af94944
chore: empty commit test #1
pranav-new-relic Nov 25, 2025
37e0d09
chore: empty commit test, expect no new deployment
pranav-new-relic Nov 25, 2025
e8fb944
chore: test commit to tigger deployment
pranav-new-relic Nov 25, 2025
50a51e8
chore: empty commit to induce ongoing deploy comment
pranav-new-relic Nov 25, 2025
c901d11
chore: changes to try validating the comment again
pranav-new-relic Nov 25, 2025
e5d6296
chore: commit to trigger deploy
pranav-new-relic Nov 25, 2025
ecac756
chore: empty commit to induce ongoing deploy comment
pranav-new-relic Nov 25, 2025
bffdc3b
chore: empty commit to induce ongoing deploy comment
pranav-new-relic Nov 25, 2025
ec0f92e
chore: final set of changes to validate tokens when they expire
pranav-new-relic Nov 25, 2025
2c8bb45
chore: remove experimental triggers, revert to comment based
pranav-new-relic Nov 26, 2025
c82a8cc
chore: merge branch 'develop' into np-test-v2
pranav-new-relic Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: hopefully cosmetic changes should work now?
  • Loading branch information
pranav-new-relic committed Nov 8, 2025
commit 2af0fc922ed7a7171d64eceb2c30afd47bc472f4
183 changes: 52 additions & 131 deletions .github/workflows/final-manual-deploy-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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

Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand All @@ -190,24 +190,27 @@ 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');
console.log('🆔 Comment ID:', comment.id);
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 }}
Expand Down Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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('════════════════════════════════════════════════════════════════');
Expand Down
Loading