Skip to content

Commit

Permalink
πŸ‘· better PR comment. Less duplication of domains in Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
mountainash authored May 7, 2024
1 parent 230baa0 commit 2c07823
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 53 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

## [2.3.2] - 2024-05-07

- truncate long ALIAS_DOMAINS values
- Unique domain added to PR comment
- Markdown table PR comment formatting
- less domain duplication in the Workflow Summary
- Truncate long ALIAS_DOMAINS values
- πŸ“¦ [email protected]

## [2.3.1] - 2024-04-26

- better logging of ALIAS_DOMAINS output
- skipping falsey ALIAS_DOMAINS values
- Better logging of ALIAS_DOMAINS output
- Skipping falsey ALIAS_DOMAINS values
- πŸ“¦ [email protected]

## [2.3.0] - 2024-04-12
Expand Down
37 changes: 12 additions & 25 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32680,40 +32680,27 @@ const run = async () => {

if (CREATE_COMMENT) {
core.info('Creating new comment on PR πŸ’¬')
const body = `
This pull request has been deployed to Vercel β–².

<table>
<tr>
<th>Latest Commit</th>
<td><code>${ SHA.substring(0, 7) }</code></td>
</tr>
<tr>
<th>πŸ‘€ Preview</th>
<td><a href='${ previewUrl }'>${ previewUrl }</a></td>
</tr>
<tr>
<th>πŸ” Inspect</th>
<td><a href='${ deployment.inspectorUrl }'>${ deployment.inspectorUrl }</a></td>
</tr>
</table>

[View GitHub Actions Workflow Logs](${ LOG_URL })
const body = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel β–² - [View GitHub Actions Workflow Logs](${ LOG_URL })

| Name | Link |
| :--- | :--- |
| πŸ‘€ Preview | <${ previewUrl }> |
| 🌐 Unique | <${ deploymentUniqueURL }> |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
`

const comment = await github.createComment(body)
core.info(`Comment created: ${ comment.html_url }`)
}

if (PR_LABELS.length) {
core.info('Adding label(s) to PR 🏷️')
const labels = await github.addLabel()

core.info(`Label(s) "${ labels.map((label) => label.name).join(', ') }" added`)
core.info(`Label(s) "${ labels.map((label) => label.name).join(', ') }" added to PR 🏷️`)
}
}

const deploymentUniqueURL = deploymentUrls[deploymentUrls.length - 1]
const deploymentUniqueURL = deploymentUrls.at(-1)

core.setOutput('PREVIEW_URL', previewUrl)
core.setOutput('DEPLOYMENT_URLS', deploymentUrls)
Expand All @@ -32726,10 +32713,10 @@ const run = async () => {
const summaryMD = `## Deploy to Vercel β–²
| Name | Link |
| :--- | :--- |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
| πŸ‘€ Preview | <${ previewUrl }> |
| 🌐 Unique | <${ deploymentUniqueURL }> |
| 🌐 Others | ${ deploymentUrls.join('<br>') } |
| 🌐 Others | ${ deploymentUrls.splice(2, -1).join('<br>') } |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
`

await core.summary.addRaw(summaryMD).write()
Expand All @@ -32738,7 +32725,7 @@ const run = async () => {
core.exportVariable('VERCEL_PREVIEW_URL', previewUrl)
core.exportVariable('VERCEL_DEPLOYMENT_UNIQUE_URL', deploymentUniqueURL)

core.info('Done')
core.info('Done βœ…')
} catch (err) {
await github.updateDeployment('failure')
core.error(`Catch Error: ${ err }`)
Expand Down
37 changes: 12 additions & 25 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,40 +145,27 @@ const run = async () => {

if (CREATE_COMMENT) {
core.info('Creating new comment on PR πŸ’¬')
const body = `
This pull request has been deployed to Vercel β–².
<table>
<tr>
<th>Latest Commit</th>
<td><code>${ SHA.substring(0, 7) }</code></td>
</tr>
<tr>
<th>πŸ‘€ Preview</th>
<td><a href='${ previewUrl }'>${ previewUrl }</a></td>
</tr>
<tr>
<th>πŸ” Inspect</th>
<td><a href='${ deployment.inspectorUrl }'>${ deployment.inspectorUrl }</a></td>
</tr>
</table>
[View GitHub Actions Workflow Logs](${ LOG_URL })
const body = `This pull request (commit \`${ SHA.substring(0, 7) }\`) has been deployed to Vercel β–² - [View GitHub Actions Workflow Logs](${ LOG_URL })
| Name | Link |
| :--- | :--- |
| πŸ‘€ Preview | <${ previewUrl }> |
| 🌐 Unique | <${ deploymentUniqueURL }> |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
`

const comment = await github.createComment(body)
core.info(`Comment created: ${ comment.html_url }`)
}

if (PR_LABELS.length) {
core.info('Adding label(s) to PR 🏷️')
const labels = await github.addLabel()

core.info(`Label(s) "${ labels.map((label) => label.name).join(', ') }" added`)
core.info(`Label(s) "${ labels.map((label) => label.name).join(', ') }" added to PR 🏷️`)
}
}

const deploymentUniqueURL = deploymentUrls[deploymentUrls.length - 1]
const deploymentUniqueURL = deploymentUrls.at(-1)

core.setOutput('PREVIEW_URL', previewUrl)
core.setOutput('DEPLOYMENT_URLS', deploymentUrls)
Expand All @@ -191,10 +178,10 @@ const run = async () => {
const summaryMD = `## Deploy to Vercel β–²
| Name | Link |
| :--- | :--- |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
| πŸ‘€ Preview | <${ previewUrl }> |
| 🌐 Unique | <${ deploymentUniqueURL }> |
| 🌐 Others | ${ deploymentUrls.join('<br>') } |
| 🌐 Others | ${ deploymentUrls.splice(2, -1).join('<br>') } |
| πŸ” Inspect | <${ deployment.inspectorUrl }> |
`

await core.summary.addRaw(summaryMD).write()
Expand All @@ -203,7 +190,7 @@ const run = async () => {
core.exportVariable('VERCEL_PREVIEW_URL', previewUrl)
core.exportVariable('VERCEL_DEPLOYMENT_UNIQUE_URL', deploymentUniqueURL)

core.info('Done')
core.info('Done βœ…')
} catch (err) {
await github.updateDeployment('failure')
core.error(`Catch Error: ${ err }`)
Expand Down

0 comments on commit 2c07823

Please sign in to comment.