diff --git a/CHANGELOG.md b/CHANGELOG.md index 164044ad..b92854c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Change Log -## [2.3.3] - 2024-05-07 +## [2.4.0] - 2024-05-07 - BUG: checking for empty, "false" and "null" ALIAS's as strings - ๐Ÿงน refactor of deploymentURLs (URLs are now a named object, not a number positioned array) +- Comments & Summary don't show empty rows ## [2.3.2] - 2024-05-07 diff --git a/dist/index.js b/dist/index.js index 7abb3c0e..394b3f54 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32678,7 +32678,7 @@ const run = async () => { } } - deploymentURLs.all = deploymentURLs.unique + deploymentURLs.all.push(deploymentURLs.unique) deploymentURLs.all.push(deploymentURLs.preview) deploymentURLs.all = deploymentURLs.all.concat(deploymentURLs.aliases) @@ -32703,15 +32703,15 @@ const run = async () => { if (CREATE_COMMENT) { core.info('Creating new comment on PR ๐Ÿ’ฌ') - const body = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel โ–ฒ - [View GitHub Actions Workflow Logs](${ LOG_URL }) + let commentMD = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel โ–ฒ - [View GitHub Actions Workflow Logs](${ LOG_URL }) | Name | Link | -| :--- | :--- | -| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> | -| ๐ŸŒ Unique | <${ deploymentURLs.unique }> | -| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` +| :--- | :--- |` + commentMD += deploymentURLs.preview ? `| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> |` : '' + commentMD += deploymentURLs.unique ? `| ๐ŸŒ Unique | <${ deploymentURLs.unique }> |` : '' + commentMD += deploymentURLs.inspector ? `| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` : '' - const comment = await github.createComment(body) + const comment = await github.createComment(commentMD) core.info(`Comment created: ${ comment.html_url }`) } @@ -32722,25 +32722,26 @@ const run = async () => { } } - core.setOutput('PREVIEW_URL', deploymentURLs.preview) - core.setOutput('DEPLOYMENT_URLS', deploymentURLs.all) - core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique) - core.setOutput('DEPLOYMENT_ID', deployment.id) - core.setOutput('DEPLOYMENT_INSPECTOR_URL', deploymentURLs.inspector) - core.setOutput('DEPLOYMENT_CREATED', true) - core.setOutput('COMMENT_CREATED', IS_PR && CREATE_COMMENT) + let summaryMD = `## Deploy to Vercel โ–ฒ - const summaryMD = `## Deploy to Vercel โ–ฒ | Name | Link | -| :--- | :--- | -| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> | -| ๐ŸŒ Unique | <${ deploymentURLs.unique }> | -| ๐ŸŒ Others | ${ deploymentURLs.aliases.join('
') } | -| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` +| :--- | :--- |` + summaryMD += deploymentURLs.preview ? `| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> |` : '' + summaryMD += deploymentURLs.unique ? `| ๐ŸŒ Unique | <${ deploymentURLs.unique }> |` : '' + summaryMD += deploymentURLs.aliases.length ? `| ๐ŸŒ Others | ${ deploymentURLs.aliases.join('
') } |` : '' + summaryMD += deploymentURLs.inspector ? `| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` : '' await core.summary.addRaw(summaryMD).write() - // Set environment variable for use in subsequent job steps + // Set environment variables for use in subsequent job steps + core.setOutput('DEPLOYMENT_CREATED', true) + core.setOutput('DEPLOYMENT_ID', deployment.id) + core.setOutput('PREVIEW_URL', deploymentURLs.preview) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique) + core.setOutput('DEPLOYMENT_URLS', deploymentURLs.all) + core.setOutput('DEPLOYMENT_INSPECTOR_URL', deploymentURLs.inspector) + core.setOutput('COMMENT_CREATED', IS_PR && CREATE_COMMENT) + core.exportVariable('VERCEL_PREVIEW_URL', deploymentURLs.preview) core.exportVariable('VERCEL_DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique) diff --git a/src/index.js b/src/index.js index fd794294..8b5ddc45 100644 --- a/src/index.js +++ b/src/index.js @@ -143,7 +143,7 @@ const run = async () => { } } - deploymentURLs.all = deploymentURLs.unique + deploymentURLs.all.push(deploymentURLs.unique) deploymentURLs.all.push(deploymentURLs.preview) deploymentURLs.all = deploymentURLs.all.concat(deploymentURLs.aliases) @@ -168,15 +168,15 @@ const run = async () => { if (CREATE_COMMENT) { core.info('Creating new comment on PR ๐Ÿ’ฌ') - const body = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel โ–ฒ - [View GitHub Actions Workflow Logs](${ LOG_URL }) + let commentMD = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel โ–ฒ - [View GitHub Actions Workflow Logs](${ LOG_URL }) | Name | Link | -| :--- | :--- | -| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> | -| ๐ŸŒ Unique | <${ deploymentURLs.unique }> | -| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` +| :--- | :--- |` + commentMD += deploymentURLs.preview ? `| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> |` : '' + commentMD += deploymentURLs.unique ? `| ๐ŸŒ Unique | <${ deploymentURLs.unique }> |` : '' + commentMD += deploymentURLs.inspector ? `| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` : '' - const comment = await github.createComment(body) + const comment = await github.createComment(commentMD) core.info(`Comment created: ${ comment.html_url }`) } @@ -187,25 +187,26 @@ const run = async () => { } } - core.setOutput('PREVIEW_URL', deploymentURLs.preview) - core.setOutput('DEPLOYMENT_URLS', deploymentURLs.all) - core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique) - core.setOutput('DEPLOYMENT_ID', deployment.id) - core.setOutput('DEPLOYMENT_INSPECTOR_URL', deploymentURLs.inspector) - core.setOutput('DEPLOYMENT_CREATED', true) - core.setOutput('COMMENT_CREATED', IS_PR && CREATE_COMMENT) + let summaryMD = `## Deploy to Vercel โ–ฒ - const summaryMD = `## Deploy to Vercel โ–ฒ | Name | Link | -| :--- | :--- | -| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> | -| ๐ŸŒ Unique | <${ deploymentURLs.unique }> | -| ๐ŸŒ Others | ${ deploymentURLs.aliases.join('
') } | -| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` +| :--- | :--- |` + summaryMD += deploymentURLs.preview ? `| ๐Ÿ‘€ Preview | <${ deploymentURLs.preview }> |` : '' + summaryMD += deploymentURLs.unique ? `| ๐ŸŒ Unique | <${ deploymentURLs.unique }> |` : '' + summaryMD += deploymentURLs.aliases.length ? `| ๐ŸŒ Others | ${ deploymentURLs.aliases.join('
') } |` : '' + summaryMD += deploymentURLs.inspector ? `| ๐Ÿ” Inspect | <${ deploymentURLs.inspector }> |` : '' await core.summary.addRaw(summaryMD).write() - // Set environment variable for use in subsequent job steps + // Set environment variables for use in subsequent job steps + core.setOutput('DEPLOYMENT_CREATED', true) + core.setOutput('DEPLOYMENT_ID', deployment.id) + core.setOutput('PREVIEW_URL', deploymentURLs.preview) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique) + core.setOutput('DEPLOYMENT_URLS', deploymentURLs.all) + core.setOutput('DEPLOYMENT_INSPECTOR_URL', deploymentURLs.inspector) + core.setOutput('COMMENT_CREATED', IS_PR && CREATE_COMMENT) + core.exportVariable('VERCEL_PREVIEW_URL', deploymentURLs.preview) core.exportVariable('VERCEL_DEPLOYMENT_UNIQUE_URL', deploymentURLs.unique)