Skip to content

Commit

Permalink
πŸ‘· Comments & Summary don't show empty rows
Browse files Browse the repository at this point in the history
  • Loading branch information
mountainash authored May 7, 2024
1 parent b2bef01 commit 395c993
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 43 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
43 changes: 22 additions & 21 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 }`)
}

Expand All @@ -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('<br>') } |
| πŸ” Inspect | <${ deploymentURLs.inspector }> |`
| :--- | :--- |`
summaryMD += deploymentURLs.preview ? `| πŸ‘€ Preview | <${ deploymentURLs.preview }> |` : ''
summaryMD += deploymentURLs.unique ? `| 🌐 Unique | <${ deploymentURLs.unique }> |` : ''
summaryMD += deploymentURLs.aliases.length ? `| 🌐 Others | ${ deploymentURLs.aliases.join('<br>') } |` : ''
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)

Expand Down
43 changes: 22 additions & 21 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 }`)
}

Expand All @@ -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('<br>') } |
| πŸ” Inspect | <${ deploymentURLs.inspector }> |`
| :--- | :--- |`
summaryMD += deploymentURLs.preview ? `| πŸ‘€ Preview | <${ deploymentURLs.preview }> |` : ''
summaryMD += deploymentURLs.unique ? `| 🌐 Unique | <${ deploymentURLs.unique }> |` : ''
summaryMD += deploymentURLs.aliases.length ? `| 🌐 Others | ${ deploymentURLs.aliases.join('<br>') } |` : ''
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)

Expand Down

0 comments on commit 395c993

Please sign in to comment.