Skip to content

Commit

Permalink
release prep
Browse files Browse the repository at this point in the history
  • Loading branch information
zrosenbauer committed May 2, 2021
1 parent 2806cae commit 2d3c82a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
12 changes: 7 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports.send = send;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.send = void 0;
exports.send = exports.buildMessage = void 0;
const webhook_1 = __nccwpck_require__(1095);
function buildMessage(input) {
return {
Expand Down Expand Up @@ -95,6 +95,7 @@ function buildMessage(input) {
]
};
}
exports.buildMessage = buildMessage;
async function send(webhookUrl, input) {
const webhook = new webhook_1.IncomingWebhook(webhookUrl);
await webhook.send(buildMessage(input));
Expand Down Expand Up @@ -217,11 +218,12 @@ exports.getTLSInfo = getTLSInfo;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.validate = void 0;
exports.validate = exports.getDaysBetweenDates = void 0;
function getDaysBetweenDates(date1, date2) {
const difference = date1.getTime() - date2.getTime();
return Math.ceil(difference / (1000 * 60 * 60 * 24));
}
exports.getDaysBetweenDates = getDaysBetweenDates;
function validate(input) {
const errors = [];
let protocolNotApproved = false;
Expand All @@ -235,15 +237,15 @@ function validate(input) {
errors.push('Certificate has expired');
expired = true;
}
if (getDaysBetweenDates(input.tlsInfo.validTo, new Date()) <= input.expirationDays) {
if (!expired && getDaysBetweenDates(input.tlsInfo.validTo, new Date()) <= input.expirationDays) {
errors.push(`Certificate will expire in less than ${input.expirationDays} days`);
expiresSoon = true;
}
return {
expired,
expiresSoon,
protocolNotApproved,
errorMessage: errors.length ? `Issues found with certificate: ${errors.join(', ')}` : null
errorMessage: errors.length ? `Issues found with certificate - ${errors.join(', ')}` : null
};
}
exports.validate = validate;
Expand Down Expand Up @@ -21910,7 +21912,7 @@ module.exports = {
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"action-tls-monitor","version":"1.0.0","description":"Monitor SSL/TLS certificates for your domains.","main":"dist/main.js","repository":"[email protected]:bluenovaio/action-tls-monitor.git","author":"@bluenovaio","license":"MIT","private":false,"scripts":{"build":"tsc","format":"prettier --write **/*.ts","format-check":"prettier --check **/*.ts","lint":"eslint src/**/*.ts","package":"ncc build --source-map --license licenses.txt","test":"jest"},"dependencies":{"@actions/core":"^1.2.6","@slack/webhook":"^6.0.0","gaxios":"^4.2.0","lodash":"^4.17.21"},"devDependencies":{"@jest/types":"^26.6.2","@types/jest":"^26.0.20","@types/lodash":"^4.14.168","@types/node":"^14.14.35","@typescript-eslint/eslint-plugin":"^4.16.1","@typescript-eslint/parser":"^4.17.0","@vercel/ncc":"0.28.2","eslint":"^7.22.0","eslint-config-semistandard":"^15.0.1","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"5.1.0","eslint-plugin-standard":"^5.0.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.5.3","ts-node":"^9.1.1","typescript":"^4.2.3","webpack":"^5.31.2"}}');
module.exports = JSON.parse('{"name":"action-tls-monitor","version":"1.0.0","description":"Monitor SSL/TLS certificates for your domains.","main":"dist/main.js","repository":"[email protected]:bluenovaio/action-tls-monitor.git","author":"@bluenovaio","license":"MIT","private":false,"scripts":{"build":"tsc","format":"prettier --write **/*.ts","format-check":"prettier --check **/*.ts","lint":"eslint src/**/*.ts","package":"ncc build --source-map --license licenses.txt","test":"jest"},"dependencies":{"@actions/core":"^1.2.7","@slack/webhook":"^6.0.0","gaxios":"^4.2.0","lodash":"^4.17.21"},"devDependencies":{"@jest/types":"^26.6.2","@types/jest":"^26.0.20","@types/lodash":"^4.14.168","@types/node":"^15.0.1","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","@vercel/ncc":"0.28.4","eslint":"^7.25.0","eslint-config-semistandard":"^15.0.1","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"5.1.0","eslint-plugin-standard":"^5.0.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.5.5","ts-node":"^9.1.1","typescript":"^4.2.3","webpack":"^5.36.2"}}');

/***/ }),

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/lib/alerts/slack.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { IncomingWebhookSendArguments } from '@slack/webhook';
import { AlertInput } from './types';
export declare function buildMessage(input: AlertInput): IncomingWebhookSendArguments;
export declare function send(webhookUrl: string, input: AlertInput): Promise<void>;
3 changes: 2 additions & 1 deletion dist/lib/alerts/slack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/alerts/slack.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/lib/validate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ interface ValidationResult {
protocolNotApproved: boolean;
errorMessage: string | null;
}
export declare function getDaysBetweenDates(date1: Date, date2: Date): number;
export declare function validate(input: ValidationInput): ValidationResult;
export {};
7 changes: 4 additions & 3 deletions dist/lib/validate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/validate.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d3c82a

Please sign in to comment.