Skip to content

Commit b401dd2

Browse files
committed
Merge branch 'refs/heads/main' into war-in/remove-onyx-connect-from-app-ts
2 parents 6363420 + 4b22ec2 commit b401dd2

239 files changed

Lines changed: 5402 additions & 29057 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/javascript/authorChecklist/index.js

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15597,6 +15597,7 @@ const CONST = {
1559715597
POLL_RATE: 10000,
1559815598
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
1559915599
APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`,
15600+
MOBILE_EXPENSIFY_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.MOBILE_EXPENSIFY_REPO}`,
1560015601
NO_ACTION: 'NO_ACTION',
1560115602
ACTION_EDIT: 'ACTION_EDIT',
1560215603
ACTION_REQUIRED: 'ACTION_REQUIRED',
@@ -15764,6 +15765,7 @@ class GithubUtils {
1576415765
number: this.getIssueOrPullRequestNumberFromURL(issue.url),
1576515766
labels: issue.labels,
1576615767
PRList: this.getStagingDeployCashPRList(issue),
15768+
PRListMobileExpensify: this.getStagingDeployCashPRListMobileExpensify(issue),
1576715769
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
1576815770
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
1576915771
isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false,
@@ -15796,6 +15798,19 @@ class GithubUtils {
1579615798
}));
1579715799
return PRList.sort((a, b) => a.number - b.number);
1579815800
}
15801+
static getStagingDeployCashPRListMobileExpensify(issue) {
15802+
let mobileExpensifySection = issue.body?.match(/Mobile-Expensify PRs:\*\*\r?\n((?:-.*\r?\n)+)/) ?? null;
15803+
if (mobileExpensifySection?.length !== 2) {
15804+
return [];
15805+
}
15806+
mobileExpensifySection = mobileExpensifySection[1];
15807+
const mobileExpensifyPRs = [...mobileExpensifySection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({
15808+
url: match[2],
15809+
number: Number.parseInt(match[3], 10),
15810+
isVerified: match[1] === 'x',
15811+
}));
15812+
return mobileExpensifyPRs.sort((a, b) => a.number - b.number);
15813+
}
1579915814
/**
1580015815
* Parse DeployBlocker section of the StagingDeployCash issue body.
1580115816
*
@@ -15835,7 +15850,7 @@ class GithubUtils {
1583515850
/**
1583615851
* Generate the issue body and assignees for a StagingDeployCash.
1583715852
*/
15838-
static generateStagingDeployCashBodyAndAssignees(tag, PRList, verifiedPRList = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isFirebaseChecked = false, isGHStatusChecked = false) {
15853+
static generateStagingDeployCashBodyAndAssignees(tag, PRList, PRListMobileExpensify, verifiedPRList = [], verifiedPRListMobileExpensify = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isFirebaseChecked = false, isGHStatusChecked = false) {
1583915854
return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr)))
1584015855
.then((data) => {
1584115856
const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, isEmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : [];
@@ -15852,12 +15867,18 @@ class GithubUtils {
1585215867
console.log('Found the following Internal QA PRs:', internalQAPRMap);
1585315868
const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : [];
1585415869
console.log('Found the following NO QA PRs:', noQAPRs);
15855-
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])];
15870+
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...verifiedPRListMobileExpensify, ...noQAPRs])];
1585615871
const sortedPRList = [...new Set((0, arrayDifference_1.default)(PRList, Object.keys(internalQAPRMap)))].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b));
15872+
const sortedPRListMobileExpensify = [...new Set(PRListMobileExpensify)].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b));
1585715873
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1585815874
// Tag version and comparison URL
1585915875
// eslint-disable-next-line max-len
15860-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
15876+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
15877+
// Add Mobile-Expensify compare link if there are Mobile-Expensify PRs
15878+
if (sortedPRListMobileExpensify.length > 0) {
15879+
issueBody += `**Mobile-Expensify Changes:** https://github.com/${CONST_1.default.GITHUB_OWNER}/${CONST_1.default.MOBILE_EXPENSIFY_REPO}/compare/production...staging\r\n`;
15880+
}
15881+
issueBody += '\r\n';
1586115882
// Warn deployers about potential bugs with the new process
1586215883
issueBody +=
1586315884
'> 💡 **Deployer FYI:** This checklist was generated using a new process. PR list from original method and detail logging can be found in the most recent [deploy workflow](https://github.com/Expensify/App/actions/workflows/deploy.yml) labeled `staging`, in the `createChecklist` action. Please tag @Julesssss with any issues.\r\n\r\n';
@@ -15870,6 +15891,15 @@ class GithubUtils {
1587015891
});
1587115892
issueBody += '\r\n\r\n';
1587215893
}
15894+
// Mobile-Expensify PR list
15895+
if (sortedPRListMobileExpensify.length > 0) {
15896+
issueBody += '**Mobile-Expensify PRs:**\r\n';
15897+
sortedPRListMobileExpensify.forEach((URL) => {
15898+
issueBody += verifiedOrNoQAPRs.includes(URL) ? '- [x]' : '- [ ]';
15899+
issueBody += ` ${URL}\r\n`;
15900+
});
15901+
issueBody += '\r\n\r\n';
15902+
}
1587315903
// Internal QA PR list
1587415904
if (!(0, isEmptyObject_1.isEmptyObject)(internalQAPRMap)) {
1587515905
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
@@ -15927,7 +15957,7 @@ class GithubUtils {
1592715957
}
1592815958
return data;
1592915959
})
15930-
.then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number)))
15960+
.then((prList) => prList?.filter((pr) => pullRequestNumbers.includes(pr.number)) ?? [])
1593115961
.catch((err) => console.error('Failed to get PR list', err));
1593215962
}
1593315963
static getPullRequestMergerLogin(pullRequestNumber) {
@@ -16012,8 +16042,8 @@ class GithubUtils {
1601216042
/**
1601316043
* Generate the URL of an New Expensify pull request given the PR number.
1601416044
*/
16015-
static getPullRequestURLFromNumber(value) {
16016-
return `${CONST_1.default.APP_REPO_URL}/pull/${value}`;
16045+
static getPullRequestURLFromNumber(value, repositoryURL) {
16046+
return `${repositoryURL}/pull/${value}`;
1601716047
}
1601816048
/**
1601916049
* Parse the pull request number from a URL.
@@ -16111,7 +16141,7 @@ class GithubUtils {
1611116141
/**
1611216142
* Get commits between two tags via the GitHub API
1611316143
*/
16114-
static async getCommitHistoryBetweenTags(fromTag, toTag) {
16144+
static async getCommitHistoryBetweenTags(fromTag, toTag, repositoryName) {
1611516145
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
1611616146
core.startGroup('Fetching paginated commits:');
1611716147
try {
@@ -16123,7 +16153,7 @@ class GithubUtils {
1612316153
core.info(`📄 Fetching page ${page} of commits...`);
1612416154
const response = await this.octokit.repos.compareCommits({
1612516155
owner: CONST_1.default.GITHUB_OWNER,
16126-
repo: CONST_1.default.APP_REPO,
16156+
repo: repositoryName,
1612716157
base: fromTag,
1612816158
head: toTag,
1612916159
per_page: perPage,
@@ -16152,6 +16182,7 @@ class GithubUtils {
1615216182
}
1615316183
core.info(`🎉 Successfully fetched ${allCommits.length} total commits`);
1615416184
core.endGroup();
16185+
console.log('');
1615516186
return allCommits.map((commit) => ({
1615616187
commit: commit.sha,
1615716188
subject: commit.commit.message,
@@ -16160,9 +16191,10 @@ class GithubUtils {
1616016191
}
1616116192
catch (error) {
1616216193
if (error instanceof request_error_1.RequestError && error.status === 404) {
16163-
console.error(`❓❓ Failed to get commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them.`);
16194+
core.error(`❓❓ Failed to get commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them.`);
1616416195
}
1616516196
core.endGroup();
16197+
console.log('');
1616616198
throw error;
1616716199
}
1616816200
}

.github/actions/javascript/awaitStagingDeploys/index.js

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12388,6 +12388,7 @@ const CONST = {
1238812388
POLL_RATE: 10000,
1238912389
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
1239012390
APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`,
12391+
MOBILE_EXPENSIFY_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.MOBILE_EXPENSIFY_REPO}`,
1239112392
NO_ACTION: 'NO_ACTION',
1239212393
ACTION_EDIT: 'ACTION_EDIT',
1239312394
ACTION_REQUIRED: 'ACTION_REQUIRED',
@@ -12555,6 +12556,7 @@ class GithubUtils {
1255512556
number: this.getIssueOrPullRequestNumberFromURL(issue.url),
1255612557
labels: issue.labels,
1255712558
PRList: this.getStagingDeployCashPRList(issue),
12559+
PRListMobileExpensify: this.getStagingDeployCashPRListMobileExpensify(issue),
1255812560
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
1255912561
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
1256012562
isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false,
@@ -12587,6 +12589,19 @@ class GithubUtils {
1258712589
}));
1258812590
return PRList.sort((a, b) => a.number - b.number);
1258912591
}
12592+
static getStagingDeployCashPRListMobileExpensify(issue) {
12593+
let mobileExpensifySection = issue.body?.match(/Mobile-Expensify PRs:\*\*\r?\n((?:-.*\r?\n)+)/) ?? null;
12594+
if (mobileExpensifySection?.length !== 2) {
12595+
return [];
12596+
}
12597+
mobileExpensifySection = mobileExpensifySection[1];
12598+
const mobileExpensifyPRs = [...mobileExpensifySection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({
12599+
url: match[2],
12600+
number: Number.parseInt(match[3], 10),
12601+
isVerified: match[1] === 'x',
12602+
}));
12603+
return mobileExpensifyPRs.sort((a, b) => a.number - b.number);
12604+
}
1259012605
/**
1259112606
* Parse DeployBlocker section of the StagingDeployCash issue body.
1259212607
*
@@ -12626,7 +12641,7 @@ class GithubUtils {
1262612641
/**
1262712642
* Generate the issue body and assignees for a StagingDeployCash.
1262812643
*/
12629-
static generateStagingDeployCashBodyAndAssignees(tag, PRList, verifiedPRList = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isFirebaseChecked = false, isGHStatusChecked = false) {
12644+
static generateStagingDeployCashBodyAndAssignees(tag, PRList, PRListMobileExpensify, verifiedPRList = [], verifiedPRListMobileExpensify = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isFirebaseChecked = false, isGHStatusChecked = false) {
1263012645
return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr)))
1263112646
.then((data) => {
1263212647
const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, isEmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : [];
@@ -12643,12 +12658,18 @@ class GithubUtils {
1264312658
console.log('Found the following Internal QA PRs:', internalQAPRMap);
1264412659
const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : [];
1264512660
console.log('Found the following NO QA PRs:', noQAPRs);
12646-
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])];
12661+
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...verifiedPRListMobileExpensify, ...noQAPRs])];
1264712662
const sortedPRList = [...new Set((0, arrayDifference_1.default)(PRList, Object.keys(internalQAPRMap)))].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b));
12663+
const sortedPRListMobileExpensify = [...new Set(PRListMobileExpensify)].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b));
1264812664
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1264912665
// Tag version and comparison URL
1265012666
// eslint-disable-next-line max-len
12651-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
12667+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
12668+
// Add Mobile-Expensify compare link if there are Mobile-Expensify PRs
12669+
if (sortedPRListMobileExpensify.length > 0) {
12670+
issueBody += `**Mobile-Expensify Changes:** https://github.com/${CONST_1.default.GITHUB_OWNER}/${CONST_1.default.MOBILE_EXPENSIFY_REPO}/compare/production...staging\r\n`;
12671+
}
12672+
issueBody += '\r\n';
1265212673
// Warn deployers about potential bugs with the new process
1265312674
issueBody +=
1265412675
'> 💡 **Deployer FYI:** This checklist was generated using a new process. PR list from original method and detail logging can be found in the most recent [deploy workflow](https://github.com/Expensify/App/actions/workflows/deploy.yml) labeled `staging`, in the `createChecklist` action. Please tag @Julesssss with any issues.\r\n\r\n';
@@ -12661,6 +12682,15 @@ class GithubUtils {
1266112682
});
1266212683
issueBody += '\r\n\r\n';
1266312684
}
12685+
// Mobile-Expensify PR list
12686+
if (sortedPRListMobileExpensify.length > 0) {
12687+
issueBody += '**Mobile-Expensify PRs:**\r\n';
12688+
sortedPRListMobileExpensify.forEach((URL) => {
12689+
issueBody += verifiedOrNoQAPRs.includes(URL) ? '- [x]' : '- [ ]';
12690+
issueBody += ` ${URL}\r\n`;
12691+
});
12692+
issueBody += '\r\n\r\n';
12693+
}
1266412694
// Internal QA PR list
1266512695
if (!(0, isEmptyObject_1.isEmptyObject)(internalQAPRMap)) {
1266612696
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
@@ -12718,7 +12748,7 @@ class GithubUtils {
1271812748
}
1271912749
return data;
1272012750
})
12721-
.then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number)))
12751+
.then((prList) => prList?.filter((pr) => pullRequestNumbers.includes(pr.number)) ?? [])
1272212752
.catch((err) => console.error('Failed to get PR list', err));
1272312753
}
1272412754
static getPullRequestMergerLogin(pullRequestNumber) {
@@ -12803,8 +12833,8 @@ class GithubUtils {
1280312833
/**
1280412834
* Generate the URL of an New Expensify pull request given the PR number.
1280512835
*/
12806-
static getPullRequestURLFromNumber(value) {
12807-
return `${CONST_1.default.APP_REPO_URL}/pull/${value}`;
12836+
static getPullRequestURLFromNumber(value, repositoryURL) {
12837+
return `${repositoryURL}/pull/${value}`;
1280812838
}
1280912839
/**
1281012840
* Parse the pull request number from a URL.
@@ -12902,7 +12932,7 @@ class GithubUtils {
1290212932
/**
1290312933
* Get commits between two tags via the GitHub API
1290412934
*/
12905-
static async getCommitHistoryBetweenTags(fromTag, toTag) {
12935+
static async getCommitHistoryBetweenTags(fromTag, toTag, repositoryName) {
1290612936
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
1290712937
core.startGroup('Fetching paginated commits:');
1290812938
try {
@@ -12914,7 +12944,7 @@ class GithubUtils {
1291412944
core.info(`📄 Fetching page ${page} of commits...`);
1291512945
const response = await this.octokit.repos.compareCommits({
1291612946
owner: CONST_1.default.GITHUB_OWNER,
12917-
repo: CONST_1.default.APP_REPO,
12947+
repo: repositoryName,
1291812948
base: fromTag,
1291912949
head: toTag,
1292012950
per_page: perPage,
@@ -12943,6 +12973,7 @@ class GithubUtils {
1294312973
}
1294412974
core.info(`🎉 Successfully fetched ${allCommits.length} total commits`);
1294512975
core.endGroup();
12976+
console.log('');
1294612977
return allCommits.map((commit) => ({
1294712978
commit: commit.sha,
1294812979
subject: commit.commit.message,
@@ -12951,9 +12982,10 @@ class GithubUtils {
1295112982
}
1295212983
catch (error) {
1295312984
if (error instanceof request_error_1.RequestError && error.status === 404) {
12954-
console.error(`❓❓ Failed to get commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them.`);
12985+
core.error(`❓❓ Failed to get commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them.`);
1295512986
}
1295612987
core.endGroup();
12988+
console.log('');
1295712989
throw error;
1295812990
}
1295912991
}

0 commit comments

Comments
 (0)