Skip to content

Commit

Permalink
🐞: Fix skipped deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
arddluma committed Feb 14, 2023
1 parent 80dba2b commit 0abe0d8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
11 changes: 11 additions & 0 deletions dist/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12814,6 +12820,11 @@ Checkout <https://dash.cloudflare.com?to=/${accountId}/pages/view/${deployment.p
await updateDeployment(token, deployment, "failure");
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;
const aliasUrl = deployment.aliases && deployment.aliases.length > 0 ? deployment.aliases[0] : deployment.url;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [],
Expand Down
13 changes: 13 additions & 0 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand Down

0 comments on commit 0abe0d8

Please sign in to comment.