From 0a41962ddfd0f9c4f2553ba4b906febe28bbf90f Mon Sep 17 00:00:00 2001 From: Uruk Date: Tue, 30 Sep 2025 01:49:38 +0200 Subject: [PATCH] fix: improve build status handling and artifact links Replaces nightly.link with direct GitHub artifact URLs for better reliability. Adds handling for cancelled builds and edge cases where workflows complete but artifacts aren't immediately available or conclusions are pending. Improves status messages to provide more detailed information for unexpected build states. --- .github/workflows/artifact-comment.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/artifact-comment.yml b/.github/workflows/artifact-comment.yml index 0e9eea6c..61a94b0a 100644 --- a/.github/workflows/artifact-comment.yml +++ b/.github/workflows/artifact-comment.yml @@ -270,22 +270,33 @@ jobs: } else if (matchingStatus) { if (matchingStatus.conclusion === 'success' && matchingArtifact) { status = '✅ Complete'; - const nightlyLink = `https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/runs/${matchingArtifact.workflow_run.id}/${matchingArtifact.name}.zip`; + const directLink = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${matchingArtifact.workflow_run.id}/artifacts/${matchingArtifact.id}`; const fileType = target.name.includes('Android') ? 'APK' : 'IPA'; - downloadLink = `[📥 Download ${fileType}](${nightlyLink})`; + downloadLink = `[📥 Download ${fileType}](${directLink})`; } else if (matchingStatus.conclusion === 'failure') { status = `❌ [Failed](${matchingStatus.url})`; downloadLink = '*Build failed*'; + } else if (matchingStatus.conclusion === 'cancelled') { + status = `⚪ [Cancelled](${matchingStatus.url})`; + downloadLink = '*Build cancelled*'; } else if (matchingStatus.status === 'in_progress') { status = `🔄 [Building...](${matchingStatus.url})`; downloadLink = '*Build in progress...*'; } else if (matchingStatus.status === 'queued') { status = `⏳ [Queued](${matchingStatus.url})`; downloadLink = '*Waiting to start...*'; + } else if (matchingStatus.status === 'completed' && !matchingStatus.conclusion) { + // Workflow completed but conclusion not yet available (rare edge case) + status = `🔄 [Finishing...](${matchingStatus.url})`; + downloadLink = '*Finalizing build...*'; + } else if (matchingStatus.status === 'completed' && matchingStatus.conclusion === 'success' && !matchingArtifact) { + // Build succeeded but artifacts not yet available + status = `⏳ [Processing artifacts...](${matchingStatus.url})`; + downloadLink = '*Preparing download...*'; } else { - // Show any other status with timestamp for debugging - status = `🔄 [${matchingStatus.status}](${matchingStatus.url})`; - downloadLink = `*Status: ${matchingStatus.status}*`; + // Fallback for any unexpected states + status = `❓ [${matchingStatus.status}/${matchingStatus.conclusion || 'pending'}](${matchingStatus.url})`; + downloadLink = `*Status: ${matchingStatus.status}, Conclusion: ${matchingStatus.conclusion || 'pending'}*`; } }