fix(release): Improve Patch Release Workflow Comments: Clearer Approval Guidance (#21894)

This commit is contained in:
Jerop Kipruto
2026-03-10 13:15:04 -04:00
committed by GitHub
parent 0b78de9601
commit 80cf2fe444
5 changed files with 77 additions and 46 deletions

View File

@@ -128,7 +128,7 @@ async function main() {
let commentBody;
if (success) {
commentBody = `✅ **Patch Release Complete!**
commentBody = `✅ **[Step 4/4] Patch Release Complete!**
**📦 Release Details:**
- **Version**: [\`${releaseVersion}\`](https://github.com/${repo.owner}/${repo.repo}/releases/tag/${releaseTag})
@@ -144,9 +144,10 @@ async function main() {
**🔗 Links:**
- [GitHub Release](https://github.com/${repo.owner}/${repo.repo}/releases/tag/${releaseTag})
- [Workflow Run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})`;
- [This release workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
- [Workflow History](https://github.com/${repo.owner}/${repo.repo}/actions/workflows/release-patch-3-release.yml)`;
} else if (raceConditionFailure) {
commentBody = `⚠️ **Patch Release Cancelled - Concurrent Release Detected**
commentBody = `⚠️ **[Step 4/4] Patch Release Cancelled - Concurrent Release Detected**
**🚦 What Happened:**
Another patch release completed while this one was in progress, causing a version conflict.
@@ -163,7 +164,7 @@ Another patch release completed while this one was in progress, causing a versio
- **Next patch should be**: \`${currentReleaseVersion}\`
- **New release tag**: \`${currentReleaseTag || 'unknown'}\``
: `
- **Status**: Version information updated since this release started`
- **Status**: Version information updated since this release was triggered`
}
**🔄 Next Steps:**
@@ -175,9 +176,10 @@ Another patch release completed while this one was in progress, causing a versio
Multiple patch releases can't run simultaneously. When they do, the second one is automatically cancelled to maintain version consistency.
**🔗 Details:**
- [View cancelled workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})`;
- [This release workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
- [Workflow History](https://github.com/${repo.owner}/${repo.repo}/actions/workflows/release-patch-3-release.yml)`;
} else {
commentBody = `❌ **Patch Release Failed!**
commentBody = `❌ **[Step 4/4] Patch Release Failed!**
**📋 Details:**
- **Version**: \`${releaseVersion || 'Unknown'}\`
@@ -190,8 +192,9 @@ Multiple patch releases can't run simultaneously. When they do, the second one i
3. You may need to retry the patch once the issue is resolved
**🔗 Troubleshooting:**
- [View workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
- [View workflow logs](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})`;
- [This release workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
- [View workflow logs](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
- [Workflow History](https://github.com/${repo.owner}/${repo.repo}/actions/workflows/release-patch-3-release.yml)`;
}
if (testMode) {

View File

@@ -145,7 +145,7 @@ async function main() {
manualCommands = manualCommandsMatch[1].trim();
}
commentBody = `🔒 **GitHub App Permission Issue**
commentBody = `🔒 **[Step 2/4] GitHub App Permission Issue**
The patch creation failed due to insufficient GitHub App permissions for creating workflow files.
@@ -169,7 +169,7 @@ After running these commands, you can re-run the patch workflow.`
const prMatch = logContent.match(/Found existing PR #(\d+): (.*)/);
if (prMatch) {
const [, prNumber, prUrl] = prMatch;
commentBody = ` **Patch PR already exists!**
commentBody = ` **[Step 2/4] Patch PR already exists!**
A patch PR for this change already exists: [#${prNumber}](${prUrl}).
@@ -185,7 +185,7 @@ A patch PR for this change already exists: [#${prNumber}](${prUrl}).
const branchMatch = logContent.match(/Hotfix branch (.*) already exists/);
if (branchMatch) {
const [, branch] = branchMatch;
commentBody = ` **Patch branch exists but no PR found!**
commentBody = ` **[Step 2/4] Patch branch exists but no PR found!**
A patch branch [\`${branch}\`](https://github.com/${repository}/tree/${branch}) exists but has no open PR.
@@ -213,7 +213,7 @@ A patch branch [\`${branch}\`](https://github.com/${repository}/tree/${branch})
logContent.includes('Cherry-pick has conflicts') ||
logContent.includes('[CONFLICTS]');
commentBody = `🚀 **Patch PR Created!**
commentBody = `🚀 **[Step 2/4] Patch PR Created!**
**📋 Patch Details:**
- **Environment**: \`${environment}\`
@@ -228,7 +228,8 @@ ${hasConflicts ? '3' : '2'}. Once merged, the patch release will automatically t
${hasConflicts ? '4' : '3'}. You'll receive updates here when the release completes
**🔗 Track Progress:**
- [View hotfix PR #${mockPrNumber}](${mockPrUrl})`;
- [View hotfix PR #${mockPrNumber}](${mockPrUrl})
- [This patch creation workflow run](https://github.com/${repository}/actions/runs/${runId})`;
} else if (hasGitHubCli) {
// Find the actual PR for the new branch using gh CLI
try {
@@ -269,7 +270,7 @@ ${hasConflicts ? '4' : '3'}. You'll receive updates here when the release comple
logContent.includes('Cherry-pick has conflicts') ||
pr.title.includes('[CONFLICTS]');
commentBody = `🚀 **Patch PR Created!**
commentBody = `🚀 **[Step 2/4] Patch PR Created!**
**📋 Patch Details:**
- **Environment**: \`${environment}\`
@@ -284,10 +285,11 @@ ${hasConflicts ? '3' : '2'}. Once merged, the patch release will automatically t
${hasConflicts ? '4' : '3'}. You'll receive updates here when the release completes
**🔗 Track Progress:**
- [View hotfix PR #${pr.number}](${pr.url})`;
- [View hotfix PR #${pr.number}](${pr.url})
- [This patch creation workflow run](https://github.com/${repository}/actions/runs/${runId})`;
} else {
// Fallback if PR not found yet
commentBody = `🚀 **Patch PR Created!**
commentBody = `🚀 **[Step 2/4] Patch PR Created!**
The patch release PR for this change has been created on branch [\`${branch}\`](https://github.com/${repository}/tree/${branch}).
@@ -296,23 +298,25 @@ The patch release PR for this change has been created on branch [\`${branch}\`](
2. Once merged, the patch release will automatically trigger
**🔗 Links:**
- [View all patch PRs](https://github.com/${repository}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)`;
- [View all patch PRs](https://github.com/${repository}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)
- [This patch creation workflow run](https://github.com/${repository}/actions/runs/${runId})`;
}
} catch (error) {
console.log('Error finding PR for branch:', error.message);
// Fallback
commentBody = `🚀 **Patch PR Created!**
commentBody = `🚀 **[Step 2/4] Patch PR Created!**
The patch release PR for this change has been created.
**🔗 Links:**
- [View all patch PRs](https://github.com/${repository}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)`;
- [View all patch PRs](https://github.com/${repository}/pulls?q=is%3Apr+is%3Aopen+label%3Apatch)
- [This patch creation workflow run](https://github.com/${repository}/actions/runs/${runId})`;
}
}
}
} else {
// Failure
commentBody = `❌ **Patch creation failed!**
commentBody = `❌ **[Step 2/4] Patch creation failed!**
There was an error creating the patch release.
@@ -326,7 +330,7 @@ There was an error creating the patch release.
}
if (!commentBody) {
commentBody = `❌ **Patch creation failed!**
commentBody = `❌ **[Step 2/4] Patch creation failed!**
No output was generated during patch creation.

View File

@@ -115,6 +115,7 @@ async function main() {
const isDryRun = argv.dryRun || body.includes('[DRY RUN]');
const forceSkipTests =
argv.forceSkipTests || process.env.FORCE_SKIP_TESTS === 'true';
const runId = process.env.GITHUB_RUN_ID || '0';
if (!headRef) {
throw new Error(
@@ -264,7 +265,7 @@ async function main() {
console.log(`Commenting on original PR ${originalPr}...`);
const npmTag = channel === 'stable' ? 'latest' : 'preview';
const commentBody = `🚀 **Patch Release Started!**
const commentBody = `🚀 **[Step 3/4] Patch Release ${environment === 'prod' ? 'Waiting for Approval' : 'Triggered'}!**
**📋 Release Details:**
- **Environment**: \`${environment}\`
@@ -273,10 +274,11 @@ async function main() {
- **Hotfix PR**: Merged ✅
- **Release Branch**: [\`${releaseRef}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${releaseRef})
**⏳ Status:** The patch release is now running. You'll receive another update when it completes.
**⏳ Status:** The patch release has been triggered${environment === 'prod' ? ' and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment' : ''}. You'll receive another update when it completes.
**🔗 Track Progress:**
- [View release workflow](https://github.com/${context.repo.owner}/${context.repo.repo}/actions)`;
- [View release workflow history](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/${workflowId})
- [This trigger workflow run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId})`;
if (!testMode) {
let tempDir;