Skip to content

Commit ff19611

Browse files
committed
Merge branch 'main' into 67202-upgrade-electron
2 parents 760a03b + 3a222d6 commit ff19611

791 files changed

Lines changed: 27678 additions & 43779 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: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15574,6 +15574,21 @@ const CONST = {
1557415574
EVENTS: {
1557515575
ISSUE_COMMENT: 'issue_comment',
1557615576
},
15577+
RUN_EVENT: {
15578+
PULL_REQUEST: 'pull_request',
15579+
PULL_REQUEST_TARGET: 'pull_request_target',
15580+
PUSH: 'push',
15581+
},
15582+
RUN_STATUS: {
15583+
COMPLETED: 'completed',
15584+
IN_PROGRESS: 'in_progress',
15585+
QUEUED: 'queued',
15586+
},
15587+
RUN_STATUS_CONCLUSION: {
15588+
SUCCESS: 'success',
15589+
},
15590+
TEST_WORKFLOW_NAME: 'Jest Unit Tests',
15591+
TEST_WORKFLOW_PATH: '.github/workflows/test.yml',
1557715592
PROPOSAL_KEYWORD: 'Proposal',
1557815593
DATE_FORMAT_STRING: 'yyyy-MM-dd',
1557915594
PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/pull/([0-9]+).*`),
@@ -15582,6 +15597,7 @@ const CONST = {
1558215597
POLL_RATE: 10000,
1558315598
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
1558415599
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}`,
1558515601
NO_ACTION: 'NO_ACTION',
1558615602
ACTION_EDIT: 'ACTION_EDIT',
1558715603
ACTION_REQUIRED: 'ACTION_REQUIRED',
@@ -15749,6 +15765,7 @@ class GithubUtils {
1574915765
number: this.getIssueOrPullRequestNumberFromURL(issue.url),
1575015766
labels: issue.labels,
1575115767
PRList: this.getStagingDeployCashPRList(issue),
15768+
PRListMobileExpensify: this.getStagingDeployCashPRListMobileExpensify(issue),
1575215769
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
1575315770
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
1575415771
isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false,
@@ -15781,6 +15798,19 @@ class GithubUtils {
1578115798
}));
1578215799
return PRList.sort((a, b) => a.number - b.number);
1578315800
}
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+
}
1578415814
/**
1578515815
* Parse DeployBlocker section of the StagingDeployCash issue body.
1578615816
*
@@ -15820,7 +15850,7 @@ class GithubUtils {
1582015850
/**
1582115851
* Generate the issue body and assignees for a StagingDeployCash.
1582215852
*/
15823-
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) {
1582415854
return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr)))
1582515855
.then((data) => {
1582615856
const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, isEmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : [];
@@ -15837,12 +15867,18 @@ class GithubUtils {
1583715867
console.log('Found the following Internal QA PRs:', internalQAPRMap);
1583815868
const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : [];
1583915869
console.log('Found the following NO QA PRs:', noQAPRs);
15840-
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])];
15870+
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...verifiedPRListMobileExpensify, ...noQAPRs])];
1584115871
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));
1584215873
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1584315874
// Tag version and comparison URL
1584415875
// eslint-disable-next-line max-len
15845-
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';
1584615882
// Warn deployers about potential bugs with the new process
1584715883
issueBody +=
1584815884
'> 💡 **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';
@@ -15855,6 +15891,15 @@ class GithubUtils {
1585515891
});
1585615892
issueBody += '\r\n\r\n';
1585715893
}
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+
}
1585815903
// Internal QA PR list
1585915904
if (!(0, isEmptyObject_1.isEmptyObject)(internalQAPRMap)) {
1586015905
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
@@ -15912,7 +15957,7 @@ class GithubUtils {
1591215957
}
1591315958
return data;
1591415959
})
15915-
.then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number)))
15960+
.then((prList) => prList?.filter((pr) => pullRequestNumbers.includes(pr.number)) ?? [])
1591615961
.catch((err) => console.error('Failed to get PR list', err));
1591715962
}
1591815963
static getPullRequestMergerLogin(pullRequestNumber) {
@@ -15997,8 +16042,8 @@ class GithubUtils {
1599716042
/**
1599816043
* Generate the URL of an New Expensify pull request given the PR number.
1599916044
*/
16000-
static getPullRequestURLFromNumber(value) {
16001-
return `${CONST_1.default.APP_REPO_URL}/pull/${value}`;
16045+
static getPullRequestURLFromNumber(value, repositoryURL) {
16046+
return `${repositoryURL}/pull/${value}`;
1600216047
}
1600316048
/**
1600416049
* Parse the pull request number from a URL.
@@ -16096,7 +16141,7 @@ class GithubUtils {
1609616141
/**
1609716142
* Get commits between two tags via the GitHub API
1609816143
*/
16099-
static async getCommitHistoryBetweenTags(fromTag, toTag) {
16144+
static async getCommitHistoryBetweenTags(fromTag, toTag, repositoryName) {
1610016145
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
1610116146
core.startGroup('Fetching paginated commits:');
1610216147
try {
@@ -16108,7 +16153,7 @@ class GithubUtils {
1610816153
core.info(`📄 Fetching page ${page} of commits...`);
1610916154
const response = await this.octokit.repos.compareCommits({
1611016155
owner: CONST_1.default.GITHUB_OWNER,
16111-
repo: CONST_1.default.APP_REPO,
16156+
repo: repositoryName,
1611216157
base: fromTag,
1611316158
head: toTag,
1611416159
per_page: perPage,
@@ -16137,6 +16182,7 @@ class GithubUtils {
1613716182
}
1613816183
core.info(`🎉 Successfully fetched ${allCommits.length} total commits`);
1613916184
core.endGroup();
16185+
console.log('');
1614016186
return allCommits.map((commit) => ({
1614116187
commit: commit.sha,
1614216188
subject: commit.commit.message,
@@ -16145,9 +16191,10 @@ class GithubUtils {
1614516191
}
1614616192
catch (error) {
1614716193
if (error instanceof request_error_1.RequestError && error.status === 404) {
16148-
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.`);
1614916195
}
1615016196
core.endGroup();
16197+
console.log('');
1615116198
throw error;
1615216199
}
1615316200
}

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

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12365,6 +12365,21 @@ const CONST = {
1236512365
EVENTS: {
1236612366
ISSUE_COMMENT: 'issue_comment',
1236712367
},
12368+
RUN_EVENT: {
12369+
PULL_REQUEST: 'pull_request',
12370+
PULL_REQUEST_TARGET: 'pull_request_target',
12371+
PUSH: 'push',
12372+
},
12373+
RUN_STATUS: {
12374+
COMPLETED: 'completed',
12375+
IN_PROGRESS: 'in_progress',
12376+
QUEUED: 'queued',
12377+
},
12378+
RUN_STATUS_CONCLUSION: {
12379+
SUCCESS: 'success',
12380+
},
12381+
TEST_WORKFLOW_NAME: 'Jest Unit Tests',
12382+
TEST_WORKFLOW_PATH: '.github/workflows/test.yml',
1236812383
PROPOSAL_KEYWORD: 'Proposal',
1236912384
DATE_FORMAT_STRING: 'yyyy-MM-dd',
1237012385
PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/pull/([0-9]+).*`),
@@ -12373,6 +12388,7 @@ const CONST = {
1237312388
POLL_RATE: 10000,
1237412389
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`,
1237512390
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}`,
1237612392
NO_ACTION: 'NO_ACTION',
1237712393
ACTION_EDIT: 'ACTION_EDIT',
1237812394
ACTION_REQUIRED: 'ACTION_REQUIRED',
@@ -12540,6 +12556,7 @@ class GithubUtils {
1254012556
number: this.getIssueOrPullRequestNumberFromURL(issue.url),
1254112557
labels: issue.labels,
1254212558
PRList: this.getStagingDeployCashPRList(issue),
12559+
PRListMobileExpensify: this.getStagingDeployCashPRListMobileExpensify(issue),
1254312560
deployBlockers: this.getStagingDeployCashDeployBlockers(issue),
1254412561
internalQAPRList: this.getStagingDeployCashInternalQA(issue),
1254512562
isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false,
@@ -12572,6 +12589,19 @@ class GithubUtils {
1257212589
}));
1257312590
return PRList.sort((a, b) => a.number - b.number);
1257412591
}
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+
}
1257512605
/**
1257612606
* Parse DeployBlocker section of the StagingDeployCash issue body.
1257712607
*
@@ -12611,7 +12641,7 @@ class GithubUtils {
1261112641
/**
1261212642
* Generate the issue body and assignees for a StagingDeployCash.
1261312643
*/
12614-
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) {
1261512645
return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr)))
1261612646
.then((data) => {
1261712647
const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, isEmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : [];
@@ -12628,12 +12658,18 @@ class GithubUtils {
1262812658
console.log('Found the following Internal QA PRs:', internalQAPRMap);
1262912659
const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : [];
1263012660
console.log('Found the following NO QA PRs:', noQAPRs);
12631-
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])];
12661+
const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...verifiedPRListMobileExpensify, ...noQAPRs])];
1263212662
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));
1263312664
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1263412665
// Tag version and comparison URL
1263512666
// eslint-disable-next-line max-len
12636-
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';
1263712673
// Warn deployers about potential bugs with the new process
1263812674
issueBody +=
1263912675
'> 💡 **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';
@@ -12646,6 +12682,15 @@ class GithubUtils {
1264612682
});
1264712683
issueBody += '\r\n\r\n';
1264812684
}
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+
}
1264912694
// Internal QA PR list
1265012695
if (!(0, isEmptyObject_1.isEmptyObject)(internalQAPRMap)) {
1265112696
console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs);
@@ -12703,7 +12748,7 @@ class GithubUtils {
1270312748
}
1270412749
return data;
1270512750
})
12706-
.then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number)))
12751+
.then((prList) => prList?.filter((pr) => pullRequestNumbers.includes(pr.number)) ?? [])
1270712752
.catch((err) => console.error('Failed to get PR list', err));
1270812753
}
1270912754
static getPullRequestMergerLogin(pullRequestNumber) {
@@ -12788,8 +12833,8 @@ class GithubUtils {
1278812833
/**
1278912834
* Generate the URL of an New Expensify pull request given the PR number.
1279012835
*/
12791-
static getPullRequestURLFromNumber(value) {
12792-
return `${CONST_1.default.APP_REPO_URL}/pull/${value}`;
12836+
static getPullRequestURLFromNumber(value, repositoryURL) {
12837+
return `${repositoryURL}/pull/${value}`;
1279312838
}
1279412839
/**
1279512840
* Parse the pull request number from a URL.
@@ -12887,7 +12932,7 @@ class GithubUtils {
1288712932
/**
1288812933
* Get commits between two tags via the GitHub API
1288912934
*/
12890-
static async getCommitHistoryBetweenTags(fromTag, toTag) {
12935+
static async getCommitHistoryBetweenTags(fromTag, toTag, repositoryName) {
1289112936
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
1289212937
core.startGroup('Fetching paginated commits:');
1289312938
try {
@@ -12899,7 +12944,7 @@ class GithubUtils {
1289912944
core.info(`📄 Fetching page ${page} of commits...`);
1290012945
const response = await this.octokit.repos.compareCommits({
1290112946
owner: CONST_1.default.GITHUB_OWNER,
12902-
repo: CONST_1.default.APP_REPO,
12947+
repo: repositoryName,
1290312948
base: fromTag,
1290412949
head: toTag,
1290512950
per_page: perPage,
@@ -12928,6 +12973,7 @@ class GithubUtils {
1292812973
}
1292912974
core.info(`🎉 Successfully fetched ${allCommits.length} total commits`);
1293012975
core.endGroup();
12976+
console.log('');
1293112977
return allCommits.map((commit) => ({
1293212978
commit: commit.sha,
1293312979
subject: commit.commit.message,
@@ -12936,9 +12982,10 @@ class GithubUtils {
1293612982
}
1293712983
catch (error) {
1293812984
if (error instanceof request_error_1.RequestError && error.status === 404) {
12939-
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.`);
1294012986
}
1294112987
core.endGroup();
12988+
console.log('');
1294212989
throw error;
1294312990
}
1294412991
}

0 commit comments

Comments
 (0)