Skip to content

Commit

Permalink
Deploy Production Code for Commit bc9b212 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Mar 6, 2022
1 parent bc9b212 commit 3b49449
Show file tree
Hide file tree
Showing 30 changed files with 2,557 additions and 315 deletions.
5 changes: 5 additions & 0 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export interface ActionInterface {
saveLocation?: string;
/** The save name of the exported file. */
saveName?: string;
/** Determines if the output shoudl be saved or not. */
setOutput: boolean;
/** The format of the file being saved. */
format?: string;
/** Optional configuration that allows the fetch request to make a series of retry requests before failing. */
Expand Down Expand Up @@ -44,6 +46,8 @@ export interface ExportInterface {
saveLocation?: string;
/** The name of the file to save. */
saveName?: string;
/** Determines if the output shoudl be saved or not. */
setOutput: boolean;
/** The format of the file to save. */
format?: string;
}
Expand All @@ -57,6 +61,7 @@ export declare const action: {
tokenConfiguration: string;
saveLocation: string;
saveName: string;
setOutput: boolean;
format: string;
};
/** Status codes for the action. */
Expand Down
3 changes: 3 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ exports.action = {
tokenConfiguration: (0, core_1.getInput)('token-configuration'),
saveLocation: (0, core_1.getInput)('save-location'),
saveName: (0, core_1.getInput)('save-name'),
setOutput: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('set-output'))
? (0, core_1.getInput)('set-output').toLowerCase() === 'true'
: false,
format: (0, core_1.getInput)('format')
};
/** Status codes for the action. */
Expand Down
2 changes: 1 addition & 1 deletion lib/fetch.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'cross-fetch/polyfill';
import { DataInterface, ExportInterface, Status } from './constants';
export declare function retrieveData({ debug: requestDebug, endpoint, configuration, auth, isTokenRequest, retry }: DataInterface): Promise<string>;
export declare function generateExport({ data, encoding, format, saveLocation, saveName }: ExportInterface): Promise<Status>;
export declare function generateExport({ data, encoding, format, saveLocation, saveName, setOutput }: ExportInterface): Promise<Status>;
6 changes: 4 additions & 2 deletions lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function retrieveData({ debug: requestDebug, endpoint, configuration, auth, isTo
}
exports.retrieveData = retrieveData;
/* Saves the data to the local file system and exports an environment variable containing the retrieved data. */
function generateExport({ data, encoding, format, saveLocation, saveName }) {
function generateExport({ data, encoding, format, saveLocation, saveName, setOutput }) {
return __awaiter(this, void 0, void 0, function* () {
(0, core_1.info)('Saving the data... 📁');
const file = `${saveLocation ? saveLocation : 'fetch-api-data-action'}/${saveName ? saveName : 'data'}.${format ? format : 'json'}`;
Expand All @@ -71,7 +71,9 @@ function generateExport({ data, encoding, format, saveLocation, saveName }) {
yield (0, io_1.mkdirP)(`${saveLocation ? saveLocation : 'fetch-api-data-action'}`);
yield fs_1.promises.writeFile(file, data, dataEncoding);
(0, core_1.info)(`Saved ${file} 💾`);
(0, core_1.exportVariable)('fetch-api-data', data);
if (setOutput) {
(0, core_1.exportVariable)('fetch-api-data', data);
}
return constants_1.Status.SUCCESS;
}
catch (error) {
Expand Down
3 changes: 2 additions & 1 deletion lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function run(configuration) {
encoding: settings.encoding,
saveLocation: settings.saveLocation,
saveName: settings.saveName,
format: settings.format
format: settings.format,
setOutput: settings.setOutput
});
}
catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/cross-fetch/dist/browser-polyfill.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/cross-fetch/dist/browser-ponyfill.js

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

31 changes: 15 additions & 16 deletions node_modules/cross-fetch/package.json

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

Loading

0 comments on commit 3b49449

Please sign in to comment.