@@ -34840,9 +34840,79 @@ var __importStar = (this && this.__importStar) || (function () {
3484034840})();
3484134841Object.defineProperty(exports, "__esModule", ({ value: true }));
3484234842const core = __importStar(__nccwpck_require__(7484));
34843+ const fs = __importStar(__nccwpck_require__(9896));
3484334844const inputs_1 = __nccwpck_require__(8422);
3484434845const github_context_1 = __nccwpck_require__(8886);
3484534846const api_client_1 = __nccwpck_require__(7475);
34847+ /**
34848+ * Get the Versioner hostname from API URL
34849+ */
34850+ function getVersionerHostname(apiUrl) {
34851+ // Convert API URL to UI hostname
34852+ // https://api.versioner.io -> https://app.versioner.io
34853+ // https://development-api.versioner.io -> https://dev.versioner.io
34854+ const url = new URL(apiUrl);
34855+ if (url.hostname === 'api.versioner.io') {
34856+ return 'https://app.versioner.io';
34857+ }
34858+ else if (url.hostname === 'development-api.versioner.io') {
34859+ return 'https://dev.versioner.io';
34860+ }
34861+ // For custom domains, try to infer UI hostname
34862+ return apiUrl.replace('api', 'app');
34863+ }
34864+ /**
34865+ * Get status emoji based on status string
34866+ */
34867+ function getStatusEmoji(status) {
34868+ switch (status) {
34869+ case 'success':
34870+ return '✅';
34871+ case 'failure':
34872+ return '❌';
34873+ case 'in_progress':
34874+ return '🔄';
34875+ default:
34876+ return '⚠️';
34877+ }
34878+ }
34879+ /**
34880+ * Write summary to GitHub Step Summary
34881+ */
34882+ function writeSummary(eventType, version, status, scmSha, apiUrl, resourceId, environment) {
34883+ const summaryPath = process.env.GITHUB_STEP_SUMMARY;
34884+ if (!summaryPath) {
34885+ core.debug('GITHUB_STEP_SUMMARY not available, skipping summary');
34886+ return;
34887+ }
34888+ const hostname = getVersionerHostname(apiUrl);
34889+ const statusEmoji = getStatusEmoji(status);
34890+ let summary = '## 🚀 Versioner Summary\n\n';
34891+ if (eventType === 'build') {
34892+ const viewUrl = `${hostname}/manage/versions?view=${resourceId}`;
34893+ summary += `**Action:** Build\n\n`;
34894+ summary += `**Status:** ${statusEmoji} ${status}\n\n`;
34895+ summary += `**Version:** \`${version}\`\n\n`;
34896+ summary += `**Git SHA:** \`${scmSha}\`\n\n`;
34897+ summary += `[View in Versioner →](${viewUrl})\n`;
34898+ }
34899+ else {
34900+ const viewUrl = `${hostname}/deployments/${resourceId}`;
34901+ summary += `**Action:** Deployment\n\n`;
34902+ summary += `**Environment:** ${environment}\n\n`;
34903+ summary += `**Status:** ${statusEmoji} ${status}\n\n`;
34904+ summary += `**Version:** \`${version}\`\n\n`;
34905+ summary += `**Git SHA:** \`${scmSha}\`\n\n`;
34906+ summary += `[View in Versioner →](${viewUrl})\n`;
34907+ }
34908+ try {
34909+ fs.appendFileSync(summaryPath, summary);
34910+ core.debug('Summary written to GITHUB_STEP_SUMMARY');
34911+ }
34912+ catch (error) {
34913+ core.warning(`Failed to write summary: ${error instanceof Error ? error.message : String(error)}`);
34914+ }
34915+ }
3484634916/**
3484734917 * Main action entrypoint
3484834918 */
@@ -34901,6 +34971,8 @@ async function run() {
3490134971 core.info(` Product ID: ${response.product_id}`);
3490234972 // Create GitHub annotation for visibility
3490334973 core.notice(`Build tracked: ${productName}@${inputs.version} (${inputs.status})`);
34974+ // Write to GitHub Step Summary
34975+ writeSummary('build', inputs.version, inputs.status, githubMetadata.scm_sha, inputs.apiUrl, response.version_id);
3490434976 }
3490534977 else {
3490634978 // Build deployment event payload
@@ -34934,6 +35006,8 @@ async function run() {
3493435006 core.info(` Event ID: ${response.event_id}`);
3493535007 // Create GitHub annotation for visibility
3493635008 core.notice(`Deployment tracked: ${productName}@${inputs.version} → ${inputs.environment} (${inputs.status})`);
35009+ // Write to GitHub Step Summary
35010+ writeSummary('deployment', inputs.version, inputs.status, githubMetadata.scm_sha, inputs.apiUrl, response.deployment_id, inputs.environment);
3493735011 }
3493835012 }
3493935013 catch (error) {
0 commit comments