From fa826c75d555e238f0a50d67bb68581f689bb405 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 30 Aug 2023 21:58:01 +0200 Subject: [PATCH 1/2] Include closed and demoted blockers in the checklist when updating --- .../createOrUpdateStagingDeploy.js | 11 +++++++++++ tests/unit/createOrUpdateStagingDeployTest.js | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js b/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js index 6465ff760473..82a79528ed09 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.js @@ -67,6 +67,8 @@ async function run() { repo: CONST.APP_REPO, labels: CONST.LABELS.DEPLOY_BLOCKER, }); + + // First, make sure we include all current deploy blockers const deployBlockers = _.reduce( openDeployBlockers, (memo, deployBlocker) => { @@ -83,6 +85,15 @@ async function run() { [], ); + // Then make sure we include any demoted or closed blockers as well, and just check them off automatically + for (const deployBlocker of currentChecklistData.deployBlockers) { + const isResolved = _.findIndex(deployBlockers, (openBlocker) => openBlocker.number === deployBlocker.number) < 0; + deployBlockers.push({ + ...deployBlocker, + isResolved, + }); + } + const didVersionChange = newVersion ? newVersion !== currentChecklistData.tag : false; checklistBody = await GithubUtils.generateStagingDeployCashBody( newTag, diff --git a/tests/unit/createOrUpdateStagingDeployTest.js b/tests/unit/createOrUpdateStagingDeployTest.js index 54c914f2500b..dd87e74f6faa 100644 --- a/tests/unit/createOrUpdateStagingDeployTest.js +++ b/tests/unit/createOrUpdateStagingDeployTest.js @@ -329,7 +329,8 @@ describe('createOrUpdateStagingDeployCash', () => { if (args.labels === CONST.LABELS.DEPLOY_BLOCKER) { return { data: [ - ...currentDeployBlockers, + // Suppose the first deploy blocker is demoted, it should not be removed from the checklist and instead just be checked off + ...currentDeployBlockers.slice(1), { html_url: 'https://github.com/Expensify/App/issues/11', // New number: 11, @@ -363,7 +364,7 @@ describe('createOrUpdateStagingDeployCash', () => { `${lineBreak}${closedCheckbox}${basePRList[6]}` + `${lineBreak}${openCheckbox}${basePRList[7]}${lineBreak}` + `${lineBreakDouble}${deployBlockerHeader}` + - `${lineBreak}${openCheckbox}${basePRList[5]}` + + `${lineBreak}${closedCheckbox}${basePRList[5]}` + `${lineBreak}${openCheckbox}${basePRList[8]}` + `${lineBreak}${closedCheckbox}${basePRList[9]}` + `${lineBreak}${openCheckbox}${baseIssueList[0]}` + From 3ac2b6a8a68bd39eb03a89c4e783a8bee8c064a1 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 30 Aug 2023 22:02:58 +0200 Subject: [PATCH 2/2] Rebuild GH actions --- .../javascript/createOrUpdateStagingDeploy/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index be5cd67b490f..701a9bca70a7 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -77,6 +77,8 @@ async function run() { repo: CONST.APP_REPO, labels: CONST.LABELS.DEPLOY_BLOCKER, }); + + // First, make sure we include all current deploy blockers const deployBlockers = _.reduce( openDeployBlockers, (memo, deployBlocker) => { @@ -93,6 +95,15 @@ async function run() { [], ); + // Then make sure we include any demoted or closed blockers as well, and just check them off automatically + for (const deployBlocker of currentChecklistData.deployBlockers) { + const isResolved = _.findIndex(deployBlockers, (openBlocker) => openBlocker.number === deployBlocker.number) < 0; + deployBlockers.push({ + ...deployBlocker, + isResolved, + }); + } + const didVersionChange = newVersion ? newVersion !== currentChecklistData.tag : false; checklistBody = await GithubUtils.generateStagingDeployCashBody( newTag,