Skip to content

Commit

Permalink
Deploy Production Code for Commit 7446b3d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Nov 9, 2024
1 parent 7446b3d commit e9b926d
Show file tree
Hide file tree
Showing 142 changed files with 1,330 additions and 13,010 deletions.
13 changes: 12 additions & 1 deletion lib/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/// <reference types="node" />
/**
* Required action data that gets initialized when running within the GitHub Actions environment.
*/
export interface ActionInterface {
/** Allows you to log the retrieved data to the terminal. */
debug?: boolean;
Expand All @@ -25,6 +27,9 @@ export interface ActionInterface {
/** The variable name the data exports as. */
variableName?: string;
}
/**
* Required data to fetch the data.
*/
export interface DataInterface {
/** Allows you to log the retrieved data to the terminal. */
debug?: boolean;
Expand All @@ -39,6 +44,9 @@ export interface DataInterface {
/** Optional configuration that allows the fetch request to make a series of retry requests before failing. */
retry?: boolean | null;
}
/**
* Required data to export the data.
*/
export interface ExportInterface {
/** The data to save. */
data: string;
Expand All @@ -55,6 +63,9 @@ export interface ExportInterface {
/** The variable name the data exports as. */
variableName?: string;
}
/**
* Required action data that gets initialized when running within the GitHub Actions environment.
*/
export declare const action: {
debug: boolean;
encoding: BufferEncoding;
Expand Down
4 changes: 3 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.Status = exports.action = void 0;
const core_1 = require("@actions/core");
const util_1 = require("./util");
// Required action data that gets initialized when running within the GitHub Actions environment.
/**
* Required action data that gets initialized when running within the GitHub Actions environment.
*/
exports.action = {
debug: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('debug'))
? (0, core_1.getInput)('debug').toLowerCase() === 'true'
Expand Down
7 changes: 6 additions & 1 deletion lib/fetch.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import 'cross-fetch/polyfill';
import { DataInterface, ExportInterface, Status } from './constants';
/**
* Retrieves data from an API endpoint.
*/
export declare function retrieveData({ debug: requestDebug, endpoint, configuration, auth, isTokenRequest, retry }: DataInterface): Promise<string>;
/**
* Generates an export file from the data provided.
*/
export declare function generateExport({ data, encoding, format, saveLocation, saveName, setOutput, variableName }: ExportInterface): Promise<Status>;
14 changes: 8 additions & 6 deletions lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateExport = exports.retrieveData = void 0;
exports.retrieveData = retrieveData;
exports.generateExport = generateExport;
const core_1 = require("@actions/core");
const io_1 = require("@actions/io");
require("cross-fetch/polyfill");
const fs_1 = require("fs");
const mustache_1 = require("mustache");
const async_retry_1 = __importDefault(require("async-retry"));
const constants_1 = require("./constants");
const util_1 = require("./util");
/* Fetches or Posts data to an API. If auth is provided it will replace the mustache variables with the data from it. */
/**
* Retrieves data from an API endpoint.
*/
function retrieveData(_a) {
return __awaiter(this, arguments, void 0, function* ({ debug: requestDebug, endpoint, configuration, auth, isTokenRequest, retry }) {
try {
Expand Down Expand Up @@ -60,8 +62,9 @@ function retrieveData(_a) {
}
});
}
exports.retrieveData = retrieveData;
/* Saves the data to the local file system and exports an environment variable containing the retrieved data. */
/**
* Generates an export file from the data provided.
*/
function generateExport(_a) {
return __awaiter(this, arguments, void 0, function* ({ data, encoding, format, saveLocation, saveName, setOutput, variableName }) {
(0, core_1.info)('Saving the data... 📁');
Expand All @@ -86,4 +89,3 @@ function generateExport(_a) {
}
});
}
exports.generateExport = generateExport;
2 changes: 1 addition & 1 deletion lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateExport = exports.retrieveData = void 0;
exports.default = run;
const core_1 = require("@actions/core");
const constants_1 = require("./constants");
const fetch_1 = require("./fetch");
Expand Down Expand Up @@ -72,4 +73,3 @@ function run(configuration) {
}
});
}
exports.default = run;
12 changes: 12 additions & 0 deletions lib/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import { ActionInterface } from './constants';
/**
* Checks to see if a value is null or undefined.
*/
export declare const isNullOrUndefined: (value: string | undefined | null) => boolean;
/**
* Checks to see if the action has the required parameters to run.
*/
export declare const hasRequiredParameters: (action: ActionInterface) => void;
/**
* Extracts the error message from an error object or string.
*/
export declare const extractErrorMessage: (error: unknown) => string;
/**
* Parses a string into a JSON object.
*/
export declare const parseData: (data: string) => Record<string, unknown> | null;
15 changes: 12 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseData = exports.extractErrorMessage = exports.hasRequiredParameters = exports.isNullOrUndefined = void 0;
/* Utility function that checks to see if a value is undefined or not. */
/**
* Checks to see if a value is null or undefined.
*/
const isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
exports.isNullOrUndefined = isNullOrUndefined;
/* Checks for the required inputs. Throws an error if any case is matched. */
/**
* Checks to see if the action has the required parameters to run.
*/
const hasRequiredParameters = (action) => {
if ((0, exports.isNullOrUndefined)(action.endpoint)) {
throw new Error('You must provide the action with at least an endpoint to retrieve data from.');
}
};
exports.hasRequiredParameters = hasRequiredParameters;
/**
* Extracts the error message from an error object or string.
*/
const extractErrorMessage = (error) => error instanceof Error
? error.message
: typeof error == 'string'
? error
: JSON.stringify(error);
exports.extractErrorMessage = extractErrorMessage;
/* Attempt to parse data as JSON and catch any errors. */
/**
* Parses a string into a JSON object.
*/
const parseData = (data) => {
try {
return JSON.parse(data);
Expand Down
1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

151 changes: 151 additions & 0 deletions node_modules/@actions/core/README.md

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

12 changes: 8 additions & 4 deletions node_modules/@actions/core/lib/command.js

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

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/command.js.map

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

4 changes: 4 additions & 0 deletions node_modules/@actions/core/lib/core.d.ts

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

Loading

0 comments on commit e9b926d

Please sign in to comment.