@@ -34670,6 +34670,12 @@ async function sendDeploymentEvent(apiUrl, apiKey, payload, failOnRejection = fa
3467034670 });
3467134671 core.info(`✅ Deployment event created successfully`);
3467234672 core.debug(`Response: ${JSON.stringify(response.data, null, 2)}`);
34673+ // Validate critical fields
34674+ if (!response.data.id) {
34675+ core.warning('⚠️ API response is missing id field');
34676+ core.warning(`Response status: ${response.status}`);
34677+ core.warning(`Response headers: ${JSON.stringify(response.headers)}`);
34678+ }
3467334679 return response.data;
3467434680 }
3467534681 catch (error) {
@@ -34747,13 +34753,15 @@ async function sendDeploymentEvent(apiUrl, apiKey, payload, failOnRejection = fa
3474734753 core.info('Continuing workflow (fail_on_rejection is false)');
3474834754 // Return a placeholder response when not failing
3474934755 return {
34750- deployment_id: '',
34751- event_id: '',
34756+ id: '',
3475234757 product_id: '',
34758+ product_name: '',
3475334759 version_id: '',
34760+ version: '',
3475434761 environment_id: '',
34762+ environment_name: '',
3475534763 status: 'rejected',
34756- created_at : new Date().toISOString(),
34764+ deployed_at : new Date().toISOString(),
3475734765 };
3475834766 }
3475934767 }
@@ -35079,21 +35087,25 @@ function writeSummary(eventType, version, status, scmSha, apiUrl, resourceId, en
3507935087 const statusEmoji = getStatusEmoji(status);
3508035088 let summary = '## 🚀 Versioner Summary\n\n';
3508135089 if (eventType === 'build') {
35082- const viewUrl = `${hostname}/manage/versions?view=${resourceId}`;
3508335090 summary += `- **Action:** Build\n`;
3508435091 summary += `- **Status:** ${statusEmoji} ${status}\n`;
3508535092 summary += `- **Version:** \`${version}\`\n`;
3508635093 summary += `- **Git SHA:** \`${scmSha}\`\n\n`;
35087- summary += `<a href="${viewUrl}" target="_blank">View in Versioner →</a>\n`;
35094+ if (resourceId && resourceId !== 'undefined') {
35095+ const viewUrl = `${hostname}/manage/versions?view=${resourceId}`;
35096+ summary += `<a href="${viewUrl}" target="_blank">View in Versioner →</a>\n`;
35097+ }
3508835098 }
3508935099 else {
35090- const viewUrl = `${hostname}/deployments/${resourceId}`;
3509135100 summary += `- **Action:** Deployment\n`;
3509235101 summary += `- **Environment:** ${environment}\n`;
3509335102 summary += `- **Status:** ${statusEmoji} ${status}\n`;
3509435103 summary += `- **Version:** \`${version}\`\n`;
3509535104 summary += `- **Git SHA:** \`${scmSha}\`\n\n`;
35096- summary += `<a href="${viewUrl}" target="_blank">View in Versioner →</a>\n`;
35105+ if (resourceId && resourceId !== 'undefined') {
35106+ const viewUrl = `${hostname}/deployments/${resourceId}`;
35107+ summary += `<a href="${viewUrl}" target="_blank">View in Versioner →</a>\n`;
35108+ }
3509735109 }
3509835110 try {
3509935111 fs.appendFileSync(summaryPath, summary);
@@ -35196,19 +35208,25 @@ async function run() {
3519635208 };
3519735209 core.info('Sending deployment event to Versioner...');
3519835210 const response = await (0, api_client_1.sendDeploymentEvent)(inputs.apiUrl, inputs.apiKey, payload, inputs.failOnRejection);
35211+ // Validate response has required fields
35212+ if (!response.id) {
35213+ core.warning('⚠️ API response missing id field - this may indicate an API issue');
35214+ core.debug(`Full response: ${JSON.stringify(response, null, 2)}`);
35215+ }
3519935216 // Set outputs
35200- core.setOutput('deployment_id', response.deployment_id);
35201- core.setOutput('event_id', response.event_id);
35202- core.setOutput('product_id', response.product_id);
35217+ core.setOutput('deployment_id', response.id || '');
35218+ core.setOutput('version_id', response.version_id || '');
35219+ core.setOutput('product_id', response.product_id || '');
35220+ core.setOutput('environment_id', response.environment_id || '');
3520335221 // Success summary
3520435222 core.info('');
3520535223 core.info(`✅ Deployment tracked successfully!`);
35206- core.info(` Deployment ID: ${response.deployment_id }`);
35207- core.info(` Event ID: ${response.event_id }`);
35224+ core.info(` Deployment ID: ${response.id || 'N/A' }`);
35225+ core.info(` Version ID: ${response.version_id || 'N/A' }`);
3520835226 // Create GitHub annotation for visibility
3520935227 core.notice(`Deployment tracked: ${productName}@${inputs.version} → ${inputs.environment} (${inputs.status})`);
3521035228 // Write to GitHub Step Summary
35211- writeSummary('deployment', inputs.version, inputs.status, githubMetadata.scm_sha, inputs.apiUrl, response.deployment_id , inputs.environment);
35229+ writeSummary('deployment', inputs.version, inputs.status, githubMetadata.scm_sha, inputs.apiUrl, response.id , inputs.environment);
3521235230 // Fail the action if deployment status indicates failure
3521335231 const statusLower = inputs.status.toLowerCase();
3521435232 if (['failed', 'fail', 'failure', 'error'].includes(statusLower)) {
0 commit comments