Skip to content

Commit

Permalink
Merge branch 'main' into paypal-field-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
deetergp committed Oct 19, 2021
2 parents 592ea97 + d60834a commit 85444ab
Show file tree
Hide file tree
Showing 134 changed files with 2,049 additions and 1,514 deletions.
27 changes: 15 additions & 12 deletions .github/actions/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -250,15 +250,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -277,6 +277,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -285,6 +286,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -311,23 +313,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ const run = function () {
// Since this is the second argument to _.union,
// it will appear later in the array than any duplicate.
// Since it is later in the array, it will be truncated by _.unique,
// and the original value of isVerified will be preserved.
// and the original value of isVerified and isAccessible will be preserved.
isVerified: false,
isAccessible: false,
}))),
false,
item => item.number,
Expand All @@ -124,6 +125,7 @@ const run = function () {
tag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
);
Expand Down
31 changes: 18 additions & 13 deletions .github/actions/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ const run = function () {
// Since this is the second argument to _.union,
// it will appear later in the array than any duplicate.
// Since it is later in the array, it will be truncated by _.unique,
// and the original value of isVerified will be preserved.
// and the original value of isVerified and isAccessible will be preserved.
isVerified: false,
isAccessible: false,
}))),
false,
item => item.number,
Expand All @@ -134,6 +135,7 @@ const run = function () {
tag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(_.where(PRList, {isAccessible: true}), 'url'),
_.pluck(deployBlockers, 'url'),
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'),
);
Expand Down Expand Up @@ -333,23 +335,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -377,15 +379,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -404,6 +406,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -412,6 +415,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -438,23 +442,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
27 changes: 15 additions & 12 deletions .github/actions/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,23 @@ class GithubUtils {
* @returns {Array<Object>} - [{url: String, number: Number, isVerified: Boolean}]
*/
static getStagingDeployCashPRList(issue) {
let PRListSection = issue.body.match(/pull requests:\*\*\r?\n((?:.*\r?\n)+)\r?\n/) || [];
let PRListSection = issue.body.match(/pull requests:\*\*(?:\r?\n)*((?:.*\r?\n(?:\s+-\s.*\r?\n)+\r?\n)+)/) || [];
if (PRListSection.length !== 2) {
// No PRs, return an empty array
console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...');
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[ ] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- \\[x] (${PULL_REQUEST_REGEX.source})`, 'g'))],
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
Expand Down Expand Up @@ -303,15 +303,15 @@ class GithubUtils {
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[ ] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[x] (${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
Expand All @@ -330,6 +330,7 @@ class GithubUtils {
* @param {String} tag
* @param {Array} PRList - The list of PR URLs which are included in this StagingDeployCash
* @param {Array} [verifiedPRList] - The list of PR URLs which have passed QA.
* @param {Array} [accessablePRList] - The list of PR URLs which have passed the accessability check.
* @param {Array} [deployBlockers] - The list of DeployBlocker URLs.
* @param {Array} [resolvedDeployBlockers] - The list of DeployBlockers URLs which have been resolved.
* @returns {Promise}
Expand All @@ -338,6 +339,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -364,23 +366,24 @@ class GithubUtils {

// PR list
if (!_.isEmpty(sortedPRList)) {
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(verifiedPRList, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessablePRList, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

// Deploy blockers
if (!_.isEmpty(deployBlockers)) {
issueBody += '\r\n**Deploy Blockers:**\r\n';
issueBody += '\r\n\r\n\r\n**Deploy Blockers:**';
_.each(sortedDeployBlockers, (URL) => {
issueBody += _.contains(resolvedDeployBlockers, URL) ? '- [x]' : '- [ ]';
issueBody += ` ${URL}\r\n`;
issueBody += `\r\n\r\n- ${URL}`;
issueBody += _.contains(resolvedDeployBlockers, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
});
}

issueBody += '\r\ncc @Expensify/applauseleads\r\n';
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n';
return issueBody;
})
.catch(err => console.warn(
Expand Down
Loading

0 comments on commit 85444ab

Please sign in to comment.