From e02870f32a3a2f2fe57e98a3f75f955c736c32a2 Mon Sep 17 00:00:00 2001 From: James Ives Date: Mon, 2 Sep 2024 15:43:58 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20Production=20Code=20for=20Commit=20171?= =?UTF-8?q?03f71bb7daade3d30d9b19218c09c860410c7=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants.d.ts | 42 +++++++++++++++++++++++++++++++----------- lib/lib.d.ts | 8 ++++---- lib/lib.js | 11 +++++++---- lib/main.js | 3 +-- lib/template.js | 4 +++- 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/lib/constants.d.ts b/lib/constants.d.ts index 5b63208bf..cfcff77b0 100644 --- a/lib/constants.d.ts +++ b/lib/constants.d.ts @@ -2,26 +2,46 @@ * Describes the action interface. */ export interface ActionInterface { - /** Deployment token. */ + /** + * Deployment token. + */ token?: string; - /** The template to use. */ + /** + * The template to use. + */ template: string; - /** The file to replace the content in. */ + /** + * The file to replace the content in. + */ file: string; - /** The minimum amount sponsored to be included. */ + /** + * The minimum amount sponsored to be included. + */ minimum: number; - /** The maximum amount sponsored to be included. */ + /** + * The maximum amount sponsored to be included. + */ maximum: number; - /** The marker at which the content should be included within. */ + /** + * The marker at which the content should be included within. + */ marker: string; - /** If the user has no sponsors, we can replace it with a fallback. */ + /** + * If the user has no sponsors, we can replace it with a fallback. + */ fallback: string; - /** Fetches organization level sponsors if true. */ + /** + * Fetches organization level sponsors if true. + */ organization: boolean; - /** Determines if inactive sponsors should be returned or not. */ + /** + * Determines if inactive sponsors should be returned or not. + */ activeOnly: boolean; - /** Determines if private sponsors should be returned or not. If marked as true, the identity of the sponsor is still - kept private, however, an anonymized version of the sponsor is still included in the list. */ + /** + * Determines if private sponsors should be returned or not. If marked as true, the identity of the sponsor is still + * kept private, however, an anonymized version of the sponsor is still included in the list. + */ includePrivate: boolean; } /** diff --git a/lib/lib.d.ts b/lib/lib.d.ts index c89c7907c..01767334a 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -1,8 +1,8 @@ import { ActionInterface, Status } from './constants'; import { generateFile, getSponsors } from './template'; -/** Initializes and runs the action. - * - * @param {ActionInterface} configuration - The configuration object. +/** + * Initializes and runs the action. + * If no configuration is provided, the action will run with the default configuration. */ -export default function run(configuration: ActionInterface): Promise; +export default function run(configuration?: ActionInterface): Promise; export { generateFile, getSponsors, ActionInterface }; diff --git a/lib/lib.js b/lib/lib.js index e6df74e89..51f9eba02 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -16,14 +16,17 @@ const template_1 = require("./template"); Object.defineProperty(exports, "generateFile", { enumerable: true, get: function () { return template_1.generateFile; } }); Object.defineProperty(exports, "getSponsors", { enumerable: true, get: function () { return template_1.getSponsors; } }); const util_1 = require("./util"); -/** Initializes and runs the action. - * - * @param {ActionInterface} configuration - The configuration object. +/** + * Initializes and runs the action. + * If no configuration is provided, the action will run with the default configuration. */ function run(configuration) { return __awaiter(this, void 0, void 0, function* () { let status = constants_1.Status.RUNNING; - const settings = Object.assign({}, configuration); + /** + * Merges the action configuration with the user configuration. + */ + const settings = Object.assign(Object.assign({}, constants_1.action), configuration); try { (0, core_1.info)(` diff --git a/lib/main.js b/lib/main.js index 89c9cefb2..5fb942725 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,6 +3,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = require("./constants"); const lib_1 = __importDefault(require("./lib")); -(0, lib_1.default)(constants_1.action); +(0, lib_1.default)(); diff --git a/lib/template.js b/lib/template.js index b369437f6..8c8ee4800 100644 --- a/lib/template.js +++ b/lib/template.js @@ -121,7 +121,9 @@ function generateTemplate(response, action) { ? user.tier.monthlyPriceInCents : 0) <= action.maximum); } - /** If there are no valid sponsors then we return the provided fallback. */ + /** + * If there are no valid sponsors then we return the provided fallback. + */ if (!filteredSponsors.length) { return action.fallback; }