Replace use of any type

This commit is contained in:
Peter Evans
2022-10-21 15:31:45 +09:00
parent f2696244ec
commit 9b60aa8a4d
2 changed files with 24 additions and 5 deletions

13
dist/index.js vendored
View File

@@ -38,6 +38,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const util_1 = __nccwpck_require__(3837);
/* eslint-disable @typescript-eslint/no-explicit-any */
function hasErrorStatus(error) {
return typeof error.code === 'number';
}
function getErrorMessage(error) {
if (error instanceof Error)
return error.message;
return String(error);
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
@@ -59,11 +68,11 @@ function run() {
}
catch (error) {
core.debug((0, util_1.inspect)(error));
if (error.status == 404) {
if (hasErrorStatus(error) && error.status == 404) {
core.setFailed('Repository not found, OR token has insufficient permissions.');
}
else {
core.setFailed(error.message);
core.setFailed(getErrorMessage(error));
}
}
});