Skip to content

Commit

Permalink
Merge branch 'main' into vit-updateArchiveMessageForAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed Jan 20, 2023
2 parents 742e4e7 + 17edc82 commit 54f1706
Show file tree
Hide file tree
Showing 117 changed files with 19,268 additions and 2,524 deletions.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/DesignDoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Design Doc tracking issue
about: A standard template to follow when leading a project
labels: Daily, NewFeature
---

## Proposal

## Tasks

- [ ] Post **Proposal (full Problem/Solution statement)** in `#expensify-open-source`
- [ ] Wait at least one full business day, and until the post has a majority (2/3) of positive reactions (👍)
- [ ] Paste Proposal in the space above with a link to the Slack thread
- [ ] Email `strategy@expensify.com` and paste in the Proposal
- [ ] Fill out the **High-level overview of the problem**, **Timeline**, and **Terminology** sections of the Design Doc
- [ ] Email `strategy@expensify.com` (continue the same email chain as before) with the link to your Design Doc
- [ ] Host a **pre-design** meeting ([example](https://expensify.slack.com/archives/C01GTK53T8Q/p1665794669539419)) in `#expensify-open-source` to discuss any necessary details in public before filling out the **High-level of proposed solution** section.
- [ ] Fill out the **High-level of proposed solution** section
- [ ] Email `stategy@expensify.com` again with links to the doc and pre-design conversation in Slack
- [ ] Add the `DesignDocReview` label to get the **High-level of proposed solution** section reviewed
- [ ] Respond to any questions or concerns and bring up blockers in Slack to get a consensus if necessary
- [ ] Confirm that the doc has the minimum necessary number of reviews before proceeding
- [ ] Host another pre-design meeting in `#expensify-open-source` to ask for engineering feedback on the technical solution.
- [ ] Fill out the **Detailed implementation of the solution** and related sections.
- [ ] Re-add the `DesignDocReview` label to this issue
- [ ] Respond to any questions or concerns and bring up blockers in Slack to get consensus if necessary
- [ ] Confirm that the doc has the minimum necessary number of reviews before proceeding
- [ ] Email `strategy@expensify.com` one last time to let them know the Design Doc is moving into the implementation phase
- [ ] Implement the changes
- [ ] Send out a follow up email to `strategy@expensify.com` once everything has been implemented and do a **Project Wrap-Up** retrospective that provides:
- Summary of what we accomplished with this project
- What went well?
- What could we have done better?
- What did we learn?
45 changes: 38 additions & 7 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ module.exports = run;

const _ = __nccwpck_require__(3571);
const {spawn} = __nccwpck_require__(3129);
const sanitizeStringForJSONParse = __nccwpck_require__(9338);

/**
* Get merge logs between two refs (inclusive) as a JavaScript object.
Expand Down Expand Up @@ -229,14 +230,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
spawnedProcess.on('error', err => reject(err));
})
.then((stdout) => {
// Remove any double-quotes from commit subjects
let sanitizedOutput = stdout.replace(/(?<="subject": ").*(?="})/g, subject => subject.replace(/"/g, "'"));
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

// Also remove any newlines and escape backslashes
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '\\\\');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
// Then remove newlines, format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');

return JSON.parse(json);
});
Expand Down Expand Up @@ -861,6 +859,39 @@ module.exports.ISSUE_OR_PULL_REQUEST_REGEX = ISSUE_OR_PULL_REQUEST_REGEX;
module.exports.POLL_RATE = POLL_RATE;


/***/ }),

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

const replacer = str => ({
'\\': '\\\\',
'\t': '\\t',
'\n': '\\n',
'\r': '\\r',
'\f': '\\f',
'"': '\\"',
}[str]);

/**
* Replace any characters in the string that will break JSON.parse for our Git Log output
*
* Solution partly taken from SO user Gabriel Rodríguez Flores 🙇
* https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading
*
* @param {String} inputString
* @returns {String}
*/
module.exports = function (inputString) {
if (typeof inputString !== 'string') {
throw new TypeError('Input must me of type String');
}

// Replace any newlines and escape backslashes
return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer);
};


/***/ }),

/***/ 7351:
Expand Down
45 changes: 38 additions & 7 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ module.exports = {

const _ = __nccwpck_require__(3571);
const {spawn} = __nccwpck_require__(3129);
const sanitizeStringForJSONParse = __nccwpck_require__(9338);

/**
* Get merge logs between two refs (inclusive) as a JavaScript object.
Expand Down Expand Up @@ -162,14 +163,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
spawnedProcess.on('error', err => reject(err));
})
.then((stdout) => {
// Remove any double-quotes from commit subjects
let sanitizedOutput = stdout.replace(/(?<="subject": ").*(?="})/g, subject => subject.replace(/"/g, "'"));
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

// Also remove any newlines and escape backslashes
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '\\\\');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
// Then remove newlines, format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');

return JSON.parse(json);
});
Expand Down Expand Up @@ -794,6 +792,39 @@ module.exports.ISSUE_OR_PULL_REQUEST_REGEX = ISSUE_OR_PULL_REQUEST_REGEX;
module.exports.POLL_RATE = POLL_RATE;


/***/ }),

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

const replacer = str => ({
'\\': '\\\\',
'\t': '\\t',
'\n': '\\n',
'\r': '\\r',
'\f': '\\f',
'"': '\\"',
}[str]);

/**
* Replace any characters in the string that will break JSON.parse for our Git Log output
*
* Solution partly taken from SO user Gabriel Rodríguez Flores 🙇
* https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading
*
* @param {String} inputString
* @returns {String}
*/
module.exports = function (inputString) {
if (typeof inputString !== 'string') {
throw new TypeError('Input must me of type String');
}

// Replace any newlines and escape backslashes
return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer);
};


/***/ }),

/***/ 7351:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const workflowURL = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOS
*/
function getDeployMessage(deployer, deployVerb, prTitle) {
let message = `🚀 [${deployVerb}](${workflowURL}) to ${isProd ? 'production' : 'staging'}`;
message += ` by @${deployer} in version: ${version} 🚀`;
message += ` by https://github.com/${deployer} in version: ${version} 🚀`;
message += `\n\n platform | result \n ---|--- \n🤖 android 🤖|${androidResult} \n🖥 desktop 🖥|${desktopResult}`;
message += `\n🍎 iOS 🍎|${iOSResult} \n🕸 web 🕸|${webResult}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const workflowURL = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOS
*/
function getDeployMessage(deployer, deployVerb, prTitle) {
let message = `🚀 [${deployVerb}](${workflowURL}) to ${isProd ? 'production' : 'staging'}`;
message += ` by @${deployer} in version: ${version} 🚀`;
message += ` by https://github.com/${deployer} in version: ${version} 🚀`;
message += `\n\n platform | result \n ---|--- \n🤖 android 🤖|${androidResult} \n🖥 desktop 🖥|${desktopResult}`;
message += `\n🍎 iOS 🍎|${iOSResult} \n🕸 web 🕸|${webResult}`;

Expand Down
36 changes: 36 additions & 0 deletions .github/actions/javascript/postTestBuildComment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Mark Pull Requests as Deployed"
description: "Mark pull requests as deployed on production or staging"
inputs:
PR_NUMBER:
description: "Pull request number"
required: true
GITHUB_TOKEN:
description: "Github token for authentication"
default: "${{ github.token }}"
ANDROID:
description: "Android job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
DESKTOP:
description: "Desktop job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
IOS:
description: "iOS job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
WEB:
description: "Web job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
ANDROID_LINK:
description: "Link for the Android build"
required: false
DESKTOP_LINK:
description: "Link for the desktop build"
required: false
IOS_LINK:
description: "Link for the iOS build"
required: false
WEB_LINK:
description: "Link for the web build"
required: false
runs:
using: "node16"
main: "./index.js"
Loading

0 comments on commit 54f1706

Please sign in to comment.