Skip to content

Commit 46ec0a9

Browse files
Merge branch 'main' into refactor-onyx-8
2 parents 07cd9d6 + 8b2a55b commit 46ec0a9

File tree

306 files changed

+10008
-5731
lines changed

Some content is hidden

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

306 files changed

+10008
-5731
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15842,7 +15842,10 @@ class GithubUtils {
1584215842
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1584315843
// Tag version and comparison URL
1584415844
// 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`;
15845+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
15846+
// Warn deployers about potential bugs with the new process
15847+
issueBody +=
15848+
'> 💡 **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';
1584615849
// PR list
1584715850
if (sortedPRList.length > 0) {
1584815851
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12633,7 +12633,10 @@ class GithubUtils {
1263312633
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1263412634
// Tag version and comparison URL
1263512635
// 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`;
12636+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
12637+
// Warn deployers about potential bugs with the new process
12638+
issueBody +=
12639+
'> 💡 **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';
1263712640
// PR list
1263812641
if (sortedPRList.length > 0) {
1263912642
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

.github/actions/javascript/checkAndroidStatus/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737335,7 +737335,10 @@ class GithubUtils {
737335737335
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
737336737336
// Tag version and comparison URL
737337737337
// eslint-disable-next-line max-len
737338-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
737338+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
737339+
// Warn deployers about potential bugs with the new process
737340+
issueBody +=
737341+
'> 💡 **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';
737339737342
// PR list
737340737343
if (sortedPRList.length > 0) {
737341737344
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

.github/actions/javascript/checkDeployBlockers/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11899,7 +11899,10 @@ class GithubUtils {
1189911899
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1190011900
// Tag version and comparison URL
1190111901
// eslint-disable-next-line max-len
11902-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
11902+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
11903+
// Warn deployers about potential bugs with the new process
11904+
issueBody +=
11905+
'> 💡 **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';
1190311906
// PR list
1190411907
if (sortedPRList.length > 0) {
1190511908
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,39 @@ async function run(): Promise<IssuesCreateResponse | void> {
5757
// Find the list of PRs merged between the current checklist and the previous checklist
5858
const mergedPRs = await GitUtils.getPullRequestsDeployedBetween(previousChecklistData.tag, newStagingTag);
5959

60+
// mergedPRs includes cherry-picked PRs that have already been released with previous checklist, so we need to filter these out
61+
const previousPRNumbers = new Set(previousChecklistData.PRList.map((pr) => pr.number));
62+
core.startGroup('Filtering PRs:');
63+
core.info('mergedPRs includes cherry-picked PRs that have already been released with previous checklist, so we need to filter these out');
64+
core.info(`Found ${previousPRNumbers.size} PRs in the previous checklist:`);
65+
core.info(JSON.stringify(Array.from(previousPRNumbers)));
66+
const newPRNumbers = mergedPRs.filter((prNum) => !previousPRNumbers.has(prNum));
67+
core.info(`Found ${newPRNumbers.length} PRs deployed since the previous checklist:`);
68+
core.info(JSON.stringify(newPRNumbers));
69+
70+
// Log the PRs that were filtered out
71+
const removedPRs = mergedPRs.filter((prNum) => previousPRNumbers.has(prNum));
72+
if (removedPRs.length > 0) {
73+
core.info(`⚠️⚠️ Filtered out the following cherry-picked PRs that were released with the previous checklist: ${removedPRs.join(', ')} ⚠️⚠️`);
74+
}
75+
core.endGroup();
76+
console.info(`[api] Checklist PRs: ${newPRNumbers.join(', ')}`);
77+
6078
// Next, we generate the checklist body
6179
let checklistBody = '';
6280
let checklistAssignees: string[] = [];
6381
if (shouldCreateNewDeployChecklist) {
6482
const stagingDeployCashBodyAndAssignees = await GithubUtils.generateStagingDeployCashBodyAndAssignees(
6583
newVersion,
66-
mergedPRs.map((value) => GithubUtils.getPullRequestURLFromNumber(value)),
84+
newPRNumbers.map((value) => GithubUtils.getPullRequestURLFromNumber(value)),
6785
);
6886
if (stagingDeployCashBodyAndAssignees) {
6987
checklistBody = stagingDeployCashBodyAndAssignees.issueBody;
7088
checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean) as string[];
7189
}
7290
} else {
7391
// Generate the updated PR list, preserving the previous state of `isVerified` for existing PRs
74-
const PRList = mergedPRs.map((prNum) => {
92+
const PRList = newPRNumbers.map((prNum) => {
7593
const indexOfPRInCurrentChecklist = currentChecklistData?.PRList.findIndex((pr) => pr.number === prNum) ?? -1;
7694
const isVerified = indexOfPRInCurrentChecklist >= 0 ? currentChecklistData?.PRList[indexOfPRInCurrentChecklist].isVerified : false;
7795
return {

.github/actions/javascript/createOrUpdateStagingDeploy/index.js

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11570,19 +11570,35 @@ async function run() {
1157011570
const currentChecklistData = shouldCreateNewDeployChecklist ? undefined : GithubUtils_1.default.getStagingDeployCashData(mostRecentChecklist);
1157111571
// Find the list of PRs merged between the current checklist and the previous checklist
1157211572
const mergedPRs = await GitUtils_1.default.getPullRequestsDeployedBetween(previousChecklistData.tag, newStagingTag);
11573+
// mergedPRs includes cherry-picked PRs that have already been released with previous checklist, so we need to filter these out
11574+
const previousPRNumbers = new Set(previousChecklistData.PRList.map((pr) => pr.number));
11575+
core.startGroup('Filtering PRs:');
11576+
core.info('mergedPRs includes cherry-picked PRs that have already been released with previous checklist, so we need to filter these out');
11577+
core.info(`Found ${previousPRNumbers.size} PRs in the previous checklist:`);
11578+
core.info(JSON.stringify(Array.from(previousPRNumbers)));
11579+
const newPRNumbers = mergedPRs.filter((prNum) => !previousPRNumbers.has(prNum));
11580+
core.info(`Found ${newPRNumbers.length} PRs deployed since the previous checklist:`);
11581+
core.info(JSON.stringify(newPRNumbers));
11582+
// Log the PRs that were filtered out
11583+
const removedPRs = mergedPRs.filter((prNum) => previousPRNumbers.has(prNum));
11584+
if (removedPRs.length > 0) {
11585+
core.info(`⚠️⚠️ Filtered out the following cherry-picked PRs that were released with the previous checklist: ${removedPRs.join(', ')} ⚠️⚠️`);
11586+
}
11587+
core.endGroup();
11588+
console.info(`[api] Checklist PRs: ${newPRNumbers.join(', ')}`);
1157311589
// Next, we generate the checklist body
1157411590
let checklistBody = '';
1157511591
let checklistAssignees = [];
1157611592
if (shouldCreateNewDeployChecklist) {
11577-
const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersion, mergedPRs.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value)));
11593+
const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersion, newPRNumbers.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value)));
1157811594
if (stagingDeployCashBodyAndAssignees) {
1157911595
checklistBody = stagingDeployCashBodyAndAssignees.issueBody;
1158011596
checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean);
1158111597
}
1158211598
}
1158311599
else {
1158411600
// Generate the updated PR list, preserving the previous state of `isVerified` for existing PRs
11585-
const PRList = mergedPRs.map((prNum) => {
11601+
const PRList = newPRNumbers.map((prNum) => {
1158611602
const indexOfPRInCurrentChecklist = currentChecklistData?.PRList.findIndex((pr) => pr.number === prNum) ?? -1;
1158711603
const isVerified = indexOfPRInCurrentChecklist >= 0 ? currentChecklistData?.PRList[indexOfPRInCurrentChecklist].isVerified : false;
1158811604
return {
@@ -11863,25 +11879,26 @@ function getCommitHistoryAsJSON(fromTag, toTag) {
1186311879
const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? versionUpdater_1.SEMANTIC_VERSION_LEVELS.PATCH : versionUpdater_1.SEMANTIC_VERSION_LEVELS.MINOR);
1186411880
fetchTag(fromTag, previousPatchVersion);
1186511881
fetchTag(toTag, previousPatchVersion);
11866-
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
11882+
core.info(`[git log] Getting pull requests merged between the following tags: ${fromTag} ${toTag}`);
11883+
core.startGroup('[git log] Fetching commits');
1186711884
return new Promise((resolve, reject) => {
1186811885
let stdout = '';
1186911886
let stderr = '';
1187011887
const args = ['log', '--format={"commit": "%H", "authorName": "%an", "subject": "%s"},', `${fromTag}...${toTag}`];
11871-
console.log(`Running command: git ${args.join(' ')}`);
11888+
core.info(`Running command: git ${args.join(' ')}`);
1187211889
const spawnedProcess = (0, child_process_1.spawn)('git', args);
11873-
spawnedProcess.on('message', console.log);
11890+
spawnedProcess.on('message', core.info);
1187411891
spawnedProcess.stdout.on('data', (chunk) => {
11875-
console.log(chunk.toString());
11892+
core.info(chunk.toString());
1187611893
stdout += chunk.toString();
1187711894
});
1187811895
spawnedProcess.stderr.on('data', (chunk) => {
11879-
console.error(chunk.toString());
11896+
core.error(chunk.toString());
1188011897
stderr += chunk.toString();
1188111898
});
1188211899
spawnedProcess.on('close', (code) => {
1188311900
if (code !== 0) {
11884-
console.log('code: ', code);
11901+
core.error(`Git command failed with code: ${code}`);
1188511902
return reject(new Error(`${stderr}`));
1188611903
}
1188711904
resolve(stdout);
@@ -11892,6 +11909,7 @@ function getCommitHistoryAsJSON(fromTag, toTag) {
1189211909
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, (subject) => (0, sanitizeStringForJSONParse_1.default)(subject));
1189311910
// Then remove newlines, format as JSON and convert to a proper JS object
1189411911
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');
11912+
core.endGroup();
1189511913
return JSON.parse(json);
1189611914
});
1189711915
}
@@ -11922,27 +11940,24 @@ function getValidMergedPRs(commits) {
1192211940
}
1192311941
/**
1192411942
* Takes in two git tags and returns a list of PR numbers of all PRs merged between those two tags
11925-
*
11926-
* This function is being refactored to use the GitHub API instead of the git log command, but for now the
11927-
* issues retrieved from the GitHub API are just being logged for testing: https://github.com/Expensify/App/issues/58775
1192811943
*/
1192911944
async function getPullRequestsDeployedBetween(fromTag, toTag) {
1193011945
console.log(`Looking for commits made between ${fromTag} and ${toTag}...`);
1193111946
const gitCommitList = await getCommitHistoryAsJSON(fromTag, toTag);
1193211947
const gitLogPullRequestNumbers = getValidMergedPRs(gitCommitList).sort((a, b) => a - b);
1193311948
console.log(`[git log] Found ${gitCommitList.length} commits.`);
11934-
core.startGroup('[git log] Parsed PRs:');
11935-
core.info(JSON.stringify(gitLogPullRequestNumbers));
11936-
core.endGroup();
11937-
// Test the new GitHub API method
11938-
// eslint-disable-next-line deprecation/deprecation
11949+
core.info(`[git log] Checklist PRs: ${gitLogPullRequestNumbers.join(', ')}`);
1193911950
const apiCommitList = await GithubUtils_1.default.getCommitHistoryBetweenTags(fromTag, toTag);
1194011951
const apiPullRequestNumbers = getValidMergedPRs(apiCommitList).sort((a, b) => a - b);
1194111952
console.log(`[api] Found ${apiCommitList.length} commits.`);
1194211953
core.startGroup('[api] Parsed PRs:');
11943-
core.info(JSON.stringify(apiPullRequestNumbers));
11954+
core.info(apiPullRequestNumbers.join(', '));
1194411955
core.endGroup();
11945-
return gitLogPullRequestNumbers;
11956+
// Print diff between git log and API results for debugging
11957+
const onlyInGitLog = gitLogPullRequestNumbers.filter((pr) => !apiPullRequestNumbers.includes(pr));
11958+
const onlyInAPI = apiPullRequestNumbers.filter((pr) => !gitLogPullRequestNumbers.includes(pr));
11959+
core.info(`PR list diff - git log only: [${onlyInGitLog.join(', ')}], API only: [${onlyInAPI.join(', ')}]`);
11960+
return apiPullRequestNumbers;
1194611961
}
1194711962
exports["default"] = {
1194811963
getPreviousExistingTag,
@@ -12203,7 +12218,10 @@ class GithubUtils {
1220312218
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1220412219
// Tag version and comparison URL
1220512220
// eslint-disable-next-line max-len
12206-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
12221+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
12222+
// Warn deployers about potential bugs with the new process
12223+
issueBody +=
12224+
'> 💡 **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';
1220712225
// PR list
1220812226
if (sortedPRList.length > 0) {
1220912227
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

.github/actions/javascript/getArtifactInfo/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11860,7 +11860,10 @@ class GithubUtils {
1186011860
const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b));
1186111861
// Tag version and comparison URL
1186211862
// eslint-disable-next-line max-len
11863-
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n`;
11863+
let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n`;
11864+
// Warn deployers about potential bugs with the new process
11865+
issueBody +=
11866+
'> 💡 **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';
1186411867
// PR list
1186511868
if (sortedPRList.length > 0) {
1186611869
issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n';

0 commit comments

Comments
 (0)