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/.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, 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]}` +