From 0abe0d85507edb2e52f03b73856dd8658de84708 Mon Sep 17 00:00:00 2001 From: Ardian <34317628+arddluma@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:35:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E:=20Fix=20skipped=20deployments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- dist/action.js | 11 +++++++++++ package.json | 2 +- src/action.ts | 13 +++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9bde573..230e555 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Generate API Token go to https://dash.cloudflare.com/profile/api-tokens ## Usage ```yml - name: Await CF Pages and send Slack notification - uses: arddluma/cloudflare-pages-slack-notification@v3 + uses: arddluma/cloudflare-pages-slack-notification@v3.1 with: # Uncomment these two lines if you wish to use the Global API Key (Not recommended!) # accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }} @@ -41,7 +41,7 @@ jobs: - uses: actions/checkout@v3 - name: Await CF Pages and send Slack notification id: cf-pages - uses: arddluma/cloudflare-pages-slack-notification@v3 + uses: arddluma/cloudflare-pages-slack-notification@v3.1 with: # Uncomment these two lines if you wish to use the Global API Key (Not recommended!) # accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }} diff --git a/dist/action.js b/dist/action.js index 844b873..481eacc 100644 --- a/dist/action.js +++ b/dist/action.js @@ -12789,6 +12789,12 @@ async function run() { console.log("Waiting for the deployment to start..."); continue; } + if (deployment.is_skipped === true) { + waiting = false; + console.log(`Deployment skipped ${deployment.id}!`); + core.setOutput(`Deployment skipped ${deployment.id}!`); + return; + } const latestStage = deployment.latest_stage; if (latestStage.name !== lastStage) { lastStage = deployment.latest_stage.name; @@ -12814,6 +12820,11 @@ Checkout 0 ? deployment.aliases[0] : deployment.url; diff --git a/package.json b/package.json index a98e17c..e1c6e81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudflare-pages-slack-notification", - "version": "3.0.0", + "version": "3.0.1", "description": "Wait for a Cloudflare Pages build to finish and send Slack notification", "main": "index.js", "keywords": [], diff --git a/src/action.ts b/src/action.ts index 01be790..d6b105a 100644 --- a/src/action.ts +++ b/src/action.ts @@ -43,6 +43,13 @@ export default async function run() { continue; } + if (deployment.is_skipped === true) { + waiting = false; + console.log(`Deployment skipped ${deployment.id}!`); + core.setOutput(`Deployment skipped ${deployment.id}!`); + return; + } + const latestStage = deployment.latest_stage; if (latestStage.name !== lastStage) { @@ -67,6 +74,12 @@ export default async function run() { return; } + if (latestStage.status === 'skipped') { + waiting = false; + core.setOutput(`Deployment skipped ${latestStage.name}!`); + return; + } + if (latestStage.name === 'deploy' && ['success', 'failed'].includes(latestStage.status)) { waiting = false;