diff --git a/.github/images/build-failed.png b/.github/images/build-failed.png new file mode 100644 index 0000000..71a8ace Binary files /dev/null and b/.github/images/build-failed.png differ diff --git a/.github/images/deployment-succeeded.png b/.github/images/deployment-succeeded.png new file mode 100644 index 0000000..ea13590 Binary files /dev/null and b/.github/images/deployment-succeeded.png differ diff --git a/README.md b/README.md index b23a522..3db5d50 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Wait for CF Pages + - name: Await CF Pages and send Slack notification id: cf-pages uses: arddluma/cf-pages-slack-notification@v2 with: @@ -45,6 +45,16 @@ jobs: githubToken: ${{ secrets.GITHUB_TOKEN }} ``` +## Screenshots + +### If build phase fails: + + ![Build Fails](.github/images/build-failed.png) + +### If deployment phase is successful: + + ![Deployment Successful](.github/images/deployment-succeeded.png) + ## Outputs * `id` - Deployment ID, example: `50ff553c-da5d-4846-8188-25ae82a3bb7d` * `environment` - Envrionment for this deployment, either `production` or `preview` diff --git a/dist/action.js b/dist/action.js index 3c4e805..097b813 100644 --- a/dist/action.js +++ b/dist/action.js @@ -11400,9 +11400,10 @@ async function run() { if (lastStage === "build") { waiting = false; core.setFailed(`Build failed on step: ${latestStage.name}!`); - slack.send(`CloudFlare Pages Build pipeline for project ${project} FAILED! -Environment: ${deployment.environment} -Deployment ID: ${deployment.id}`).then(() => { + slack.send(`:x: CloudFlare Pages \`Build\` pipeline for project *${project}* \`FAILED\`! +Environment: *${deployment.environment}* +Deployment ID: *${deployment.id}* +Checkout `).then(() => { console.log("Slack message for BUILD failed pipeline sent!"); }).catch((err) => { console.error(err); @@ -11424,19 +11425,21 @@ Deployment ID: ${deployment.id}`).then(() => { core.setOutput("alias", aliasUrl); core.setOutput("success", deployment.latest_stage.status === "success" ? true : false); if (deployment.latest_stage.status === "success" && true) { - slack.send(`CloudFlare Pages Depolyment pipeline for project ${project} SUCCEEDED! -Environment: ${deployment.environment} -Deployment ID: ${deployment.id} -Deployment URL: ${deployment.url}`).then(() => { + slack.send(`:white_check_mark: CloudFlare Pages \`Deployment\` pipeline for project *${project}* \`SUCCEEDED\`! +Environment: *${deployment.environment}* +Deployment ID: *${deployment.id}* +Deployment URL: ${deployment.url} +Checkout `).then(() => { console.log("Slack message for DEPLOYMENT succedded pipeline sent!"); }).catch((err) => { console.error(err); }); } if (deployment.latest_stage.status === "failed" && true) { - slack.send(`CloudFlare Pages Depolyment pipeline for project ${project} FAILED! -Environment: ${deployment.environment} -Deployment ID: ${deployment.id}`).then(() => { + slack.send(`:x: CloudFlare Pages \`Deployment\` pipeline for project *${project}* \`FAILED\`! +Environment: *${deployment.environment}* +Deployment ID: *${deployment.id}* +Checkout `).then(() => { console.log("Slack message for DEPLOYMENT failed pipeline sent!"); }).catch((err) => { console.error(err); diff --git a/src/action.ts b/src/action.ts index 3dd2f4d..8315427 100644 --- a/src/action.ts +++ b/src/action.ts @@ -49,7 +49,7 @@ export default async function run() { if (lastStage === 'build') { waiting = false; core.setFailed(`Build failed on step: ${latestStage.name}!`); - slack.send(`CloudFlare Pages Build pipeline for project ${project} FAILED!\nEnvironment: ${deployment.environment}\nDeployment ID: ${deployment.id}`).then(() => { + slack.send(`:x: CloudFlare Pages \`Build\` pipeline for project *${project}* \`FAILED\`!\nEnvironment: *${deployment.environment}*\nDeployment ID: *${deployment.id}*\nCheckout `).then(() => { console.log('Slack message for BUILD failed pipeline sent!'); }).catch((err) => { console.error(err); @@ -75,7 +75,7 @@ export default async function run() { core.setOutput('success', deployment.latest_stage.status === 'success' ? true : false); if (deployment.latest_stage.status === 'success' && true) { - slack.send(`CloudFlare Pages Depolyment pipeline for project ${project} SUCCEEDED!\nEnvironment: ${deployment.environment}\nDeployment ID: ${deployment.id}\nDeployment URL: ${deployment.url}`).then(() => { + slack.send(`:white_check_mark: CloudFlare Pages \`Deployment\` pipeline for project *${project}* \`SUCCEEDED\`!\nEnvironment: *${deployment.environment}*\nDeployment ID: *${deployment.id}*\nDeployment URL: ${deployment.url}\nCheckout `).then(() => { console.log('Slack message for DEPLOYMENT succedded pipeline sent!'); }).catch((err) => { console.error(err); @@ -83,7 +83,7 @@ export default async function run() { } if (deployment.latest_stage.status === 'failed' && true) { - slack.send(`CloudFlare Pages Depolyment pipeline for project ${project} FAILED!\nEnvironment: ${deployment.environment}\nDeployment ID: ${deployment.id}`).then(() => { + slack.send(`:x: CloudFlare Pages \`Deployment\` pipeline for project *${project}* \`FAILED\`!\nEnvironment: *${deployment.environment}*\nDeployment ID: *${deployment.id}*\nCheckout `).then(() => { console.log('Slack message for DEPLOYMENT failed pipeline sent!'); }).catch((err) => { console.error(err);