Skip to content

Commit

Permalink
Merge pull request #6047 from Expensify/Rory-FixAccessibilityChecklist
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham authored Oct 25, 2021
2 parents f6a85d9 + 74950f6 commit baeb79d
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 416 deletions.
49 changes: 14 additions & 35 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 Down Expand Up @@ -325,8 +304,8 @@ class GithubUtils {
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
51 changes: 15 additions & 36 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 Down Expand Up @@ -454,8 +433,8 @@ class GithubUtils {
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
49 changes: 14 additions & 35 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 Down Expand Up @@ -378,8 +357,8 @@ class GithubUtils {
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
49 changes: 14 additions & 35 deletions .github/actions/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,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 @@ -220,26 +210,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 Down Expand Up @@ -296,8 +275,8 @@ class GithubUtils {
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 baeb79d

Please sign in to comment.