Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'sanitizeStringForJSONParse.js', 'promiseWhile.js', 'CONST.js', 'versionUpdater.js', 'ActionUtils.js' .github file to TypeScript #37975

Merged
merged 41 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8bffd0d
ref: move sanitizeStringForJSONParse to TS
kubabutkiewicz Mar 8, 2024
d59a55f
ref: move const and promiseWhile to TS
kubabutkiewicz Mar 8, 2024
1804cdb
ref: move ActionUtils to TS
kubabutkiewicz Mar 8, 2024
9cf90e2
fix: tests
kubabutkiewicz Mar 8, 2024
b89a97c
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 11, 2024
2e8f2c6
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 12, 2024
17942ce
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 13, 2024
6957113
fix: typecheck
kubabutkiewicz Mar 13, 2024
153561b
fix: validate actions
kubabutkiewicz Mar 13, 2024
9df8f4e
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 14, 2024
d3033e7
fix: resolve comments
kubabutkiewicz Mar 14, 2024
fd12300
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 15, 2024
79e65c7
fix: tests
kubabutkiewicz Mar 15, 2024
82f2162
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 25, 2024
28f2219
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 26, 2024
78bdb4c
fix: adjusted imports
kubabutkiewicz Mar 26, 2024
ad5eb49
feat: run gh-actions-build
kubabutkiewicz Mar 26, 2024
63cf03a
fix: lint
kubabutkiewicz Mar 27, 2024
67c4e73
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 27, 2024
910b9f6
fix: run gh-actions-build
kubabutkiewicz Mar 27, 2024
a0358f5
fix: resolve comments
kubabutkiewicz Mar 27, 2024
e8167d9
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 27, 2024
df99b41
fix: run gh-actions-build
kubabutkiewicz Mar 27, 2024
1500bbc
fix: typecheck
kubabutkiewicz Mar 27, 2024
1e1fd16
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 27, 2024
fddb07b
fix: run gh-actions-build
kubabutkiewicz Mar 27, 2024
5fbffbe
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 28, 2024
be27995
fix: resolve comments
kubabutkiewicz Mar 28, 2024
437a9b4
fix: run gh-actions-build
kubabutkiewicz Mar 28, 2024
9113492
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 29, 2024
9656c8b
fix: run gh-actions-build
kubabutkiewicz Mar 29, 2024
6451e1d
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Mar 29, 2024
76b6f28
fix: run gh-actions-build
kubabutkiewicz Mar 29, 2024
6723071
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Apr 2, 2024
2bad90b
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Apr 3, 2024
e585214
fix: resolve comment
kubabutkiewicz Apr 3, 2024
3338c04
fix: run gh-actions-build
kubabutkiewicz Apr 3, 2024
2d2512d
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Apr 3, 2024
41f0d72
fix: run gh-actions-build
kubabutkiewicz Apr 3, 2024
ef5f493
fix: typecheck
kubabutkiewicz Apr 3, 2024
25318df
fix: run gh-actions-build
kubabutkiewicz Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16846,9 +16846,12 @@ exports["default"] = newComponentCategory;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const CONST = {
const GIT_CONST = {
GITHUB_OWNER: 'Expensify',
APP_REPO: 'App',
};
const CONST = {
...GIT_CONST,
APPLAUSE_BOT: 'applausebot',
OS_BOTIFY: 'OSBotify',
LABELS: {
Expand All @@ -16857,11 +16860,9 @@ const CONST = {
INTERNAL_QA: 'InternalQA',
},
DATE_FORMAT_STRING: 'yyyy-MM-dd',
APP_REPO_URL: '',
APP_REPO_GIT_URL: '',
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`,
};
CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`;
CONST.APP_REPO_GIT_URL = `git@github.com:${CONST.GITHUB_OWNER}/${CONST.APP_REPO}.git`;
exports["default"] = CONST;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import lodashThrottle from 'lodash/throttle';
import ActionUtils from '@github/libs/ActionUtils';
import {getStringInput} from '@github/libs/ActionUtils';
import CONST from '@github/libs/CONST';
import GitHubUtils, {POLL_RATE} from '@github/libs/GithubUtils';
import {promiseDoWhile} from '@github/libs/promiseWhile';
Expand All @@ -9,11 +9,11 @@ type CurrentStagingDeploys = Awaited<ReturnType<typeof GitHubUtils.octokit.actio

function run() {
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] ActionUtils', ActionUtils);
console.info('[awaitStagingDeploys] getStringInput', getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GitHubUtils);
console.info('[awaitStagingDeploys] promiseDoWhile', promiseDoWhile);

const tag = ActionUtils.getStringInput('TAG', {required: false});
const tag = getStringInput('TAG', {required: false});
console.info('[awaitStagingDeploys] run() tag', tag);

let currentStagingDeploys: CurrentStagingDeploys = [];
Expand Down
230 changes: 119 additions & 111 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,108 +4,6 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 970:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

const core = __nccwpck_require__(2186);

/**
* Safely parse a JSON input to a GitHub Action.
*
* @param {String} name - The name of the input.
* @param {Object} options - Options to pass to core.getInput
* @param {*} [defaultValue] - A default value to provide for the input.
* Not required if the {required: true} option is given in the second arg to this function.
* @returns {any}
*/
function getJSONInput(name, options, defaultValue = undefined) {
const input = core.getInput(name, options);
if (input) {
return JSON.parse(input);
}
return defaultValue;
}

/**
* Safely access a string input to a GitHub Action, or fall back on a default if the string is empty.
*
* @param {String} name
* @param {Object} options
* @param {*} [defaultValue]
* @returns {string|undefined}
*/
function getStringInput(name, options, defaultValue = undefined) {
const input = core.getInput(name, options);
if (!input) {
return defaultValue;
}
return input;
}

module.exports = {
getJSONInput,
getStringInput,
};


/***/ }),

/***/ 4502:
/***/ ((module) => {

/**
* Simulates a while loop where the condition is determined by the result of a Promise.
*
* @param {Function} condition
* @param {Function} action
* @returns {Promise}
*/
function promiseWhile(condition, action) {
console.info('[promiseWhile] promiseWhile()');

return new Promise((resolve, reject) => {
const loop = function () {
if (!condition()) {
resolve();
} else {
const actionResult = action();
console.info('[promiseWhile] promiseWhile() actionResult', actionResult);
Promise.resolve(actionResult).then(loop).catch(reject);
}
};
loop();
});
}

/**
* Simulates a do-while loop where the condition is determined by the result of a Promise.
*
* @param {Function} condition
* @param {Function} action
* @returns {Promise}
*/
function promiseDoWhile(condition, action) {
console.info('[promiseWhile] promiseDoWhile()');

return new Promise((resolve, reject) => {
console.info('[promiseWhile] promiseDoWhile() condition', condition);
const actionResult = action();
console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult);
actionResult
.then(() => promiseWhile(condition, action))
.then(() => resolve())
.catch(reject);
});
}

module.exports = {
promiseWhile,
promiseDoWhile,
};


/***/ }),

/***/ 7351:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

Expand Down Expand Up @@ -12251,16 +12149,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
/* eslint-disable @typescript-eslint/naming-convention */
const throttle_1 = __importDefault(__nccwpck_require__(2891));
const ActionUtils_1 = __importDefault(__nccwpck_require__(970));
const ActionUtils_1 = __nccwpck_require__(6981);
const CONST_1 = __importDefault(__nccwpck_require__(9873));
const GithubUtils_1 = __importStar(__nccwpck_require__(9296));
const promiseWhile_1 = __nccwpck_require__(4502);
const promiseWhile_1 = __nccwpck_require__(9438);
function run() {
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] ActionUtils', ActionUtils_1.default);
console.info('[awaitStagingDeploys] getStringInput', ActionUtils_1.getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GithubUtils_1.default);
console.info('[awaitStagingDeploys] promiseDoWhile', promiseWhile_1.promiseDoWhile);
const tag = ActionUtils_1.default.getStringInput('TAG', { required: false });
const tag = (0, ActionUtils_1.getStringInput)('TAG', { required: false });
console.info('[awaitStagingDeploys] run() tag', tag);
let currentStagingDeploys = [];
console.info('[awaitStagingDeploys] run() _.throttle', throttle_1.default);
Expand Down Expand Up @@ -12304,6 +12202,68 @@ if (require.main === require.cache[eval('__filename')]) {
exports["default"] = run;


/***/ }),

/***/ 6981:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getStringInput = exports.getJSONInput = void 0;
const core = __importStar(__nccwpck_require__(2186));
/**
* Safely parse a JSON input to a GitHub Action.
*
* @param name - The name of the input.
* @param options - Options to pass to core.getInput
* @param [defaultValue] - A default value to provide for the input.
* Not required if the {required: true} option is given in the second arg to this function.
*/
function getJSONInput(name, options, defaultValue) {
const input = core.getInput(name, options);
if (input) {
return JSON.parse(input);
}
return defaultValue;
}
exports.getJSONInput = getJSONInput;
/**
* Safely access a string input to a GitHub Action, or fall back on a default if the string is empty.
*/
function getStringInput(name, options, defaultValue) {
const input = core.getInput(name, options);
if (!input) {
return defaultValue;
}
return input;
}
exports.getStringInput = getStringInput;


/***/ }),

/***/ 9873:
Expand All @@ -12312,9 +12272,12 @@ exports["default"] = run;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const CONST = {
const GIT_CONST = {
GITHUB_OWNER: 'Expensify',
APP_REPO: 'App',
};
const CONST = {
...GIT_CONST,
APPLAUSE_BOT: 'applausebot',
OS_BOTIFY: 'OSBotify',
LABELS: {
Expand All @@ -12323,11 +12286,9 @@ const CONST = {
INTERNAL_QA: 'InternalQA',
},
DATE_FORMAT_STRING: 'yyyy-MM-dd',
APP_REPO_URL: '',
APP_REPO_GIT_URL: '',
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`,
};
CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`;
CONST.APP_REPO_GIT_URL = `git@github.com:${CONST.GITHUB_OWNER}/${CONST.APP_REPO}.git`;
exports["default"] = CONST;


Expand Down Expand Up @@ -12784,6 +12745,53 @@ exports["default"] = GithubUtils;
module.exports = GithubUtils;


/***/ }),

/***/ 9438:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.promiseDoWhile = exports.promiseWhile = void 0;
/**
* Simulates a while loop where the condition is determined by the result of a Promise.
*/
function promiseWhile(condition, action) {
console.info('[promiseWhile] promiseWhile()');
return new Promise((resolve, reject) => {
const loop = function () {
if (!condition()) {
resolve();
}
else {
const actionResult = action?.();
console.info('[promiseWhile] promiseWhile() actionResult', actionResult);
Promise.resolve(actionResult).then(loop).catch(reject);
}
};
loop();
});
}
exports.promiseWhile = promiseWhile;
/**
* Simulates a do-while loop where the condition is determined by the result of a Promise.
*/
function promiseDoWhile(condition, action) {
console.info('[promiseWhile] promiseDoWhile()');
return new Promise((resolve, reject) => {
console.info('[promiseWhile] promiseDoWhile() condition', condition);
const actionResult = action?.();
console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult);
actionResult
?.then(() => promiseWhile(condition, action))
.then(() => resolve())
.catch(reject);
});
}
exports.promiseDoWhile = promiseDoWhile;


/***/ }),

/***/ 8227:
Expand Down
Loading
Loading