Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into azimgd-fix-inverted-flatlist
Browse files Browse the repository at this point in the history
  • Loading branch information
azimgd authored Oct 26, 2021
2 parents ead40c6 + 0b070b7 commit 5763378
Show file tree
Hide file tree
Showing 138 changed files with 784 additions and 702 deletions.
66 changes: 27 additions & 39 deletions .github/actions/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,26 +213,16 @@ class GithubUtils {
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
const PRList = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[([ x])] QA\\s+- \\[([ x])] Accessibility`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
number: Number.parseInt(match[2], 10),
isVerified: match[3] === 'x',
isAccessible: match[4] === 'x',
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: true,
}),
);
return _.sortBy(
_.union(unverifiedPRs, verifiedPRs),
'number',
);
return _.sortBy(PRList, 'number');
}

/**
Expand All @@ -249,26 +239,15 @@ class GithubUtils {
return [];
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...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(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
const deployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[([ x])]\\s(${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: true,
url: match[2],
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}),
);
return _.sortBy(
_.union(unresolvedDeployBlockers, resolvedDeployBlockers),
'number',
);
return _.sortBy(deployBlockers, 'number');
}

/**
Expand All @@ -277,7 +256,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} [accessiblePRList] - 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 @@ -286,7 +265,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -297,6 +276,15 @@ class GithubUtils {
'html_url',
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs);
const accessibleOrNoQAPRs = _.union(accessiblePRList, noQAPRs);

const sortedPRList = _.chain(PRList)
.difference(automatedPRs)
.unique()
Expand All @@ -316,17 +304,17 @@ class GithubUtils {
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
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';
issueBody += _.contains(verifiedOrNoQAPRs, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessibleOrNoQAPRs, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const run = function () {
const PRList = _.sortBy(
_.unique(
_.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, number => ({
number,
number: Number.parseInt(number, 10),
url: GithubUtils.getPullRequestURLFromNumber(number),

// Since this is the second argument to _.union,
Expand Down
68 changes: 28 additions & 40 deletions .github/actions/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const run = function () {
const PRList = _.sortBy(
_.unique(
_.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, number => ({
number,
number: Number.parseInt(number, 10),
url: GithubUtils.getPullRequestURLFromNumber(number),

// Since this is the second argument to _.union,
Expand Down Expand Up @@ -342,26 +342,16 @@ class GithubUtils {
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
const PRList = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[([ x])] QA\\s+- \\[([ x])] Accessibility`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
number: Number.parseInt(match[2], 10),
isVerified: match[3] === 'x',
isAccessible: match[4] === 'x',
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: true,
}),
);
return _.sortBy(
_.union(unverifiedPRs, verifiedPRs),
'number',
);
return _.sortBy(PRList, 'number');
}

/**
Expand All @@ -378,26 +368,15 @@ class GithubUtils {
return [];
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
const deployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[([ x])]\\s(${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: false,
url: match[2],
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}),
);
const resolvedDeployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: true,
}),
);
return _.sortBy(
_.union(unresolvedDeployBlockers, resolvedDeployBlockers),
'number',
);
return _.sortBy(deployBlockers, 'number');
}

/**
Expand All @@ -406,7 +385,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} [accessiblePRList] - 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 @@ -415,7 +394,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -426,6 +405,15 @@ class GithubUtils {
'html_url',
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs);
const accessibleOrNoQAPRs = _.union(accessiblePRList, noQAPRs);

const sortedPRList = _.chain(PRList)
.difference(automatedPRs)
.unique()
Expand All @@ -445,17 +433,17 @@ class GithubUtils {
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
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';
issueBody += _.contains(verifiedOrNoQAPRs, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessibleOrNoQAPRs, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

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

Expand Down
66 changes: 27 additions & 39 deletions .github/actions/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,26 +266,16 @@ class GithubUtils {
return [];
}
PRListSection = PRListSection[1];
const unverifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[ \\] QA`, 'g'))],
const PRList = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[([ x])] QA\\s+- \\[([ x])] Accessibility`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: false,
number: Number.parseInt(match[2], 10),
isVerified: match[3] === 'x',
isAccessible: match[4] === 'x',
}),
);
const verifiedPRs = _.map(
[...PRListSection.matchAll(new RegExp(`- (${PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getPullRequestNumberFromURL(match[1]),
isVerified: true,
}),
);
return _.sortBy(
_.union(unverifiedPRs, verifiedPRs),
'number',
);
return _.sortBy(PRList, 'number');
}

/**
Expand All @@ -302,26 +292,15 @@ class GithubUtils {
return [];
}
deployBlockerSection = deployBlockerSection[1];
const unresolvedDeployBlockers = _.map(
[...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(`- (${ISSUE_OR_PULL_REQUEST_REGEX.source})\\s+- \\[x\\] QA`, 'g'))],
const deployBlockers = _.map(
[...deployBlockerSection.matchAll(new RegExp(`- \\[([ x])]\\s(${ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))],
match => ({
url: match[1],
number: GithubUtils.getIssueOrPullRequestNumberFromURL(match[1]),
isResolved: true,
url: match[2],
number: Number.parseInt(match[3], 10),
isResolved: match[1] === 'x',
}),
);
return _.sortBy(
_.union(unresolvedDeployBlockers, resolvedDeployBlockers),
'number',
);
return _.sortBy(deployBlockers, 'number');
}

/**
Expand All @@ -330,7 +309,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} [accessiblePRList] - 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 @@ -339,7 +318,7 @@ class GithubUtils {
tag,
PRList,
verifiedPRList = [],
accessablePRList = [],
accessiblePRList = [],
deployBlockers = [],
resolvedDeployBlockers = [],
) {
Expand All @@ -350,6 +329,15 @@ class GithubUtils {
'html_url',
);
console.log('Filtering out the following automated pull requests:', automatedPRs);

const noQAPRs = _.pluck(
_.filter(data, PR => (PR.title || '').toUpperCase().startsWith('[NO QA]')),
'html_url',
);
console.log('Found the following NO QA PRs:', noQAPRs);
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs);
const accessibleOrNoQAPRs = _.union(accessiblePRList, noQAPRs);

const sortedPRList = _.chain(PRList)
.difference(automatedPRs)
.unique()
Expand All @@ -369,17 +357,17 @@ class GithubUtils {
issueBody += '\r\n**This release contains changes from the following pull requests:**';
_.each(sortedPRList, (URL) => {
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';
issueBody += _.contains(verifiedOrNoQAPRs, URL) ? '\r\n - [x] QA' : '\r\n - [ ] QA';
issueBody += _.contains(accessibleOrNoQAPRs, URL) ? '\r\n - [x] Accessibility' : '\r\n - [ ] Accessibility';
});
}

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

Expand Down
Loading

0 comments on commit 5763378

Please sign in to comment.