diff --git a/.github/actions/checkDeployBlockers/index.js b/.github/actions/checkDeployBlockers/index.js index eb39d3a08daa..12c95c8c76f1 100644 --- a/.github/actions/checkDeployBlockers/index.js +++ b/.github/actions/checkDeployBlockers/index.js @@ -313,7 +313,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js b/.github/actions/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js index 5484a14c2f0b..75b890934476 100644 --- a/.github/actions/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js +++ b/.github/actions/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js @@ -69,11 +69,15 @@ const run = function () { // We're in the create flow, not update // TODO: if there are open DeployBlockers and we are opening a new checklist, // then we should close / remove the DeployBlockerCash label from those - return GithubUtils.generateStagingDeployCashBody(newVersion, mergedPRs); + return GithubUtils.generateStagingDeployCashBody( + newVersion, + _.map(mergedPRs, GithubUtils.getPullRequestURLFromNumber), + ); } // There is an open StagingDeployCash, so we'll be updating it, not creating a new one const currentStagingDeployCashData = GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[0]); + console.log('Parsed the following data from the current StagingDeployCash:', currentStagingDeployCashData); currentStagingDeployCashIssueNumber = currentStagingDeployCashData.number; const newDeployBlockers = _.map(deployBlockerResponse.data, ({url}) => ({ @@ -88,9 +92,9 @@ const run = function () { // Generate the PR list, preserving the previous state of `isVerified` for existing PRs const PRList = _.sortBy( _.unique( - _.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, url => ({ - url, - number: GithubUtils.getPullRequestNumberFromURL(url), + _.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, number => ({ + number, + url: GithubUtils.getPullRequestURLFromNumber(number), // Since this is the second argument to _.union, // it will appear later in the array than any duplicate. diff --git a/.github/actions/createOrUpdateStagingDeploy/index.js b/.github/actions/createOrUpdateStagingDeploy/index.js index 2c1fc3d73568..4bc71ff41a46 100644 --- a/.github/actions/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/createOrUpdateStagingDeploy/index.js @@ -79,11 +79,15 @@ const run = function () { // We're in the create flow, not update // TODO: if there are open DeployBlockers and we are opening a new checklist, // then we should close / remove the DeployBlockerCash label from those - return GithubUtils.generateStagingDeployCashBody(newVersion, mergedPRs); + return GithubUtils.generateStagingDeployCashBody( + newVersion, + _.map(mergedPRs, GithubUtils.getPullRequestURLFromNumber), + ); } // There is an open StagingDeployCash, so we'll be updating it, not creating a new one const currentStagingDeployCashData = GithubUtils.getStagingDeployCashData(stagingDeployResponse.data[0]); + console.log('Parsed the following data from the current StagingDeployCash:', currentStagingDeployCashData); currentStagingDeployCashIssueNumber = currentStagingDeployCashData.number; const newDeployBlockers = _.map(deployBlockerResponse.data, ({url}) => ({ @@ -98,9 +102,9 @@ const run = function () { // Generate the PR list, preserving the previous state of `isVerified` for existing PRs const PRList = _.sortBy( _.unique( - _.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, url => ({ - url, - number: GithubUtils.getPullRequestNumberFromURL(url), + _.union(currentStagingDeployCashData.PRList, _.map(mergedPRs, number => ({ + number, + url: GithubUtils.getPullRequestURLFromNumber(number), // Since this is the second argument to _.union, // it will appear later in the array than any duplicate. @@ -431,7 +435,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/getMergeCommitForPullRequest/index.js b/.github/actions/getMergeCommitForPullRequest/index.js index 281144981729..cbb10320c6a2 100644 --- a/.github/actions/getMergeCommitForPullRequest/index.js +++ b/.github/actions/getMergeCommitForPullRequest/index.js @@ -341,7 +341,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/getReleaseBody/index.js b/.github/actions/getReleaseBody/index.js index bd52404c57cc..4321be9b8293 100644 --- a/.github/actions/getReleaseBody/index.js +++ b/.github/actions/getReleaseBody/index.js @@ -284,7 +284,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/isPullRequestMergeable/index.js b/.github/actions/isPullRequestMergeable/index.js index 8abd0df83937..c1c4c59e8bd9 100644 --- a/.github/actions/isPullRequestMergeable/index.js +++ b/.github/actions/isPullRequestMergeable/index.js @@ -287,7 +287,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/isStagingDeployLocked/index.js b/.github/actions/isStagingDeployLocked/index.js index d85fc16db06f..1808c24b2b7f 100644 --- a/.github/actions/isStagingDeployLocked/index.js +++ b/.github/actions/isStagingDeployLocked/index.js @@ -263,7 +263,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/markPullRequestsAsDeployed/index.js b/.github/actions/markPullRequestsAsDeployed/index.js index f7206fc4fbcf..9ce5a031d0d7 100644 --- a/.github/actions/markPullRequestsAsDeployed/index.js +++ b/.github/actions/markPullRequestsAsDeployed/index.js @@ -337,7 +337,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/reopenIssueWithComment/index.js b/.github/actions/reopenIssueWithComment/index.js index c0e4bd2822ba..9e09931d78b3 100644 --- a/.github/actions/reopenIssueWithComment/index.js +++ b/.github/actions/reopenIssueWithComment/index.js @@ -276,7 +276,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/actions/triggerWorkflowAndWait/index.js b/.github/actions/triggerWorkflowAndWait/index.js index f592f53a454b..559a754eff75 100644 --- a/.github/actions/triggerWorkflowAndWait/index.js +++ b/.github/actions/triggerWorkflowAndWait/index.js @@ -427,7 +427,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/.github/libs/GithubUtils.js b/.github/libs/GithubUtils.js index d8cda484ba70..025a9c9281b2 100644 --- a/.github/libs/GithubUtils.js +++ b/.github/libs/GithubUtils.js @@ -225,7 +225,7 @@ class GithubUtils { let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n`; // PR list - if (!_.isEmpty(PRList)) { + if (!_.isEmpty(sortedPRList)) { issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; _.each(sortedPRList, (URL) => { issueBody += _.contains(verifiedPRList, URL) ? '- [x]' : '- [ ]'; diff --git a/tests/unit/createOrUpdateStagingDeployTest.js b/tests/unit/createOrUpdateStagingDeployTest.js index d19cc6a1c570..fce7a09a9775 100644 --- a/tests/unit/createOrUpdateStagingDeployTest.js +++ b/tests/unit/createOrUpdateStagingDeployTest.js @@ -87,11 +87,7 @@ describe('createOrUpdateStagingDeployCash', () => { state: 'closed', }; - const baseNewPullRequests = [ - 'https://github.com/Expensify/Expensify.cash/pull/6', - 'https://github.com/Expensify/Expensify.cash/pull/7', - 'https://github.com/Expensify/Expensify.cash/pull/8', - ]; + const baseNewPullRequests = ['6', '7', '8']; test('creates new issue when there is none open', () => { mockGetInput.mockImplementation((arg) => { @@ -179,10 +175,7 @@ describe('createOrUpdateStagingDeployCash', () => { }); // New pull requests to add to open StagingDeployCash - const newPullRequests = [ - 'https://github.com/Expensify/Expensify.cash/pull/9', - 'https://github.com/Expensify/Expensify.cash/pull/10', - ]; + const newPullRequests = ['9', '10']; mockGetPullRequestsMergedBetween.mockImplementation((fromRef, toRef) => { if (fromRef === '1.0.1-0' && toRef === '1.0.2-2') { return [ @@ -229,7 +222,7 @@ describe('createOrUpdateStagingDeployCash', () => { // eslint-disable-next-line max-len html_url: `https://github.com/Expensify/Expensify.cash/issues/${openStagingDeployCashBefore.number}`, // eslint-disable-next-line max-len - body: `**Release Version:** \`1.0.2-2\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n\r\n**This release contains changes from the following pull requests:**\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/6\r\n- [x] https://github.com/Expensify/Expensify.cash/pull/7\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/8\r\n- [ ] ${newPullRequests[0]}\r\n- [ ] ${newPullRequests[1]}\r\n\r\n**Deploy Blockers:**\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/6\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/9\r\n- [x] https://github.com/Expensify/Expensify.cash/issues/10\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/11\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/12\r\n\r\ncc @Expensify/applauseleads\r\n`, + body: `**Release Version:** \`1.0.2-2\`\r\n**Compare Changes:** https://github.com/Expensify/Expensify.cash/compare/production...staging\r\n\r\n**This release contains changes from the following pull requests:**\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/6\r\n- [x] https://github.com/Expensify/Expensify.cash/pull/7\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/8\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/${newPullRequests[0]}\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/${newPullRequests[1]}\r\n\r\n**Deploy Blockers:**\r\n- [ ] https://github.com/Expensify/Expensify.cash/pull/6\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/9\r\n- [x] https://github.com/Expensify/Expensify.cash/issues/10\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/11\r\n- [ ] https://github.com/Expensify/Expensify.cash/issues/12\r\n\r\ncc @Expensify/applauseleads\r\n`, }); }); });