Skip to content

Commit 6322af5

Browse files
committed
fix: linting
1 parent 931b6e5 commit 6322af5

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

dist/index.js

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3530,6 +3530,7 @@ const core = __importStar(__webpack_require__(470));
35303530
const github = __importStar(__webpack_require__(469));
35313531
const create_1 = __webpack_require__(646);
35323532
const finish_1 = __webpack_require__(209);
3533+
const delete_all_1 = __webpack_require__(832);
35333534
// nullify getInput empty results
35343535
// to allow coalescence ?? operator
35353536
function getInput(name, options) {
@@ -3588,23 +3589,28 @@ function run() {
35883589
}
35893590
catch (error) {
35903591
core.error(error);
3591-
// core.setFailed(error)
35923592
throw error;
35933593
}
35943594
break;
35953595
case 'finish':
35963596
try {
3597-
yield finish_1.finish(client, deploymentId, status, logsUrl, environmentUrl);
3597+
yield finish_1.finish(client, Number(deploymentId), status, logsUrl, environmentUrl);
35983598
}
35993599
catch (error) {
36003600
core.error(error);
3601-
// core.setFailed(`Could not finish a deployment: ${JSON.stringify(error, null, 2)}`)
36023601
throw error;
36033602
}
36043603
break;
36053604
case 'delete':
36063605
break;
36073606
case 'delete-all':
3607+
try {
3608+
yield delete_all_1.deleteAll(client, environment);
3609+
}
3610+
catch (error) {
3611+
core.error(error);
3612+
throw error;
3613+
}
36083614
break;
36093615
}
36103616
});
@@ -3635,7 +3641,7 @@ exports.finish = void 0;
36353641
const github_1 = __webpack_require__(469);
36363642
function finish(client, deploymentId, status, logUrl, environmentUrl) {
36373643
return __awaiter(this, void 0, void 0, function* () {
3638-
const statusResult = yield client.repos.createDeploymentStatus(Object.assign(Object.assign({}, github_1.context.repo), { deployment_id: Number(deploymentId), state: status, log_url: logUrl, environment_url: environmentUrl }));
3644+
const statusResult = yield client.repos.createDeploymentStatus(Object.assign(Object.assign({}, github_1.context.repo), { deployment_id: deploymentId, state: status, log_url: logUrl, environment_url: environmentUrl }));
36393645
console.log(`created deployment status: ${JSON.stringify(statusResult.data, null, 2)}`);
36403646
});
36413647
}
@@ -9467,6 +9473,42 @@ function sync (path, options) {
94679473
}
94689474

94699475

9476+
/***/ }),
9477+
9478+
/***/ 832:
9479+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
9480+
9481+
"use strict";
9482+
9483+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9484+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9485+
return new (P || (P = Promise))(function (resolve, reject) {
9486+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9487+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9488+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9489+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9490+
});
9491+
};
9492+
Object.defineProperty(exports, "__esModule", { value: true });
9493+
exports.deleteAll = void 0;
9494+
const github_1 = __webpack_require__(469);
9495+
function deleteAll(client, environment) {
9496+
return __awaiter(this, void 0, void 0, function* () {
9497+
const deployments = yield client.repos.listDeployments(Object.assign(Object.assign({}, github_1.context.repo), { environment }));
9498+
yield Promise.all(deployments.data.map((deployment) => __awaiter(this, void 0, void 0, function* () {
9499+
// invalidate deployment first
9500+
// since we can't delete active deployment
9501+
console.log(`invalidate deployment: ${deployment.id}`);
9502+
yield client.repos.createDeploymentStatus(Object.assign(Object.assign({}, github_1.context.repo), { deployment_id: deployment.id, state: 'failure' }));
9503+
// then delete it
9504+
console.log(`delete deployment: ${deployment.url}`);
9505+
yield client.request(deployment.url, { method: 'DELETE' });
9506+
})));
9507+
});
9508+
}
9509+
exports.deleteAll = deleteAll;
9510+
9511+
94709512
/***/ }),
94719513

94729514
/***/ 835:

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@types/sinon": "^9.0.4",
3434
"@typescript-eslint/parser": "^2.8.0",
3535
"@zeit/ncc": "^0.20.5",
36+
"git-validate": "^2.2.4",
3637
"jest": "^24.9.0",
3738
"jest-circus": "^24.9.0",
3839
"js-yaml": "^3.13.1",
@@ -41,5 +42,8 @@
4142
"ts-jest": "^24.2.0",
4243
"ts-standard": "^8.0.1",
4344
"typescript": "^3.6.4"
44-
}
45+
},
46+
"pre-commit": [
47+
"all"
48+
]
4549
}

src/delete-all.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export async function deleteAll (
1717
...context.repo,
1818
deployment_id: deployment.id,
1919
state: 'failure'
20-
});
20+
})
2121

2222
// then delete it
2323
console.log(`delete deployment: ${deployment.url}`)
24-
await client.request(deployment.url, { "method": "DELETE" })
24+
await client.request(deployment.url, { method: 'DELETE' })
2525
}))
2626
}

0 commit comments

Comments
 (0)