@@ -11462,7 +11462,10 @@ const GitUtils_1 = __importDefault(__nccwpck_require__(1547));
1146211462async function run() {
1146311463 // Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time
1146411464 const packageJson = JSON.parse(fs_1.default.readFileSync('package.json', 'utf8'));
11465- const newVersionTag = packageJson.version;
11465+ // The checklist will use the package.json version, e.g. '1.2.3-4'
11466+ const newVersion = packageJson.version;
11467+ // The staging tag will use the package.json version with a '-staging' suffix, e.g. '1.2.3-4-staging'
11468+ const newStagingTag = `${packageJson.version}-staging`;
1146611469 try {
1146711470 // Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers
1146811471 const { data: recentDeployChecklists } = await GithubUtils_1.default.octokit.issues.listForRepo({
@@ -11493,12 +11496,12 @@ async function run() {
1149311496 const previousChecklistData = GithubUtils_1.default.getStagingDeployCashData(previousChecklist);
1149411497 const currentChecklistData = shouldCreateNewDeployChecklist ? undefined : GithubUtils_1.default.getStagingDeployCashData(mostRecentChecklist);
1149511498 // Find the list of PRs merged between the current checklist and the previous checklist
11496- const mergedPRs = await GitUtils_1.default.getPullRequestsMergedBetween(previousChecklistData.tag ?? '', newVersionTag );
11499+ const mergedPRs = await GitUtils_1.default.getPullRequestsMergedBetween(previousChecklistData.tag, newStagingTag );
1149711500 // Next, we generate the checklist body
1149811501 let checklistBody = '';
1149911502 let checklistAssignees = [];
1150011503 if (shouldCreateNewDeployChecklist) {
11501- const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag , mergedPRs.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value)));
11504+ const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersion , mergedPRs.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value)));
1150211505 if (stagingDeployCashBodyAndAssignees) {
1150311506 checklistBody = stagingDeployCashBodyAndAssignees.issueBody;
1150411507 checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean);
@@ -11540,8 +11543,8 @@ async function run() {
1154011543 isResolved,
1154111544 });
1154211545 });
11543- const didVersionChange = newVersionTag !== currentChecklistData?.tag ;
11544- const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag , PRList.map((pr) => pr.url), PRList.filter((pr) => pr.isVerified).map((pr) => pr.url), deployBlockers.map((blocker) => blocker.url), deployBlockers.filter((blocker) => blocker.isResolved).map((blocker) => blocker.url), currentChecklistData?.internalQAPRList.filter((pr) => pr.isResolved).map((pr) => pr.url), didVersionChange ? false : currentChecklistData.isTimingDashboardChecked, didVersionChange ? false : currentChecklistData.isFirebaseChecked, didVersionChange ? false : currentChecklistData.isGHStatusChecked);
11546+ const didVersionChange = newVersion !== currentChecklistData?.version ;
11547+ const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersion , PRList.map((pr) => pr.url), PRList.filter((pr) => pr.isVerified).map((pr) => pr.url), deployBlockers.map((blocker) => blocker.url), deployBlockers.filter((blocker) => blocker.isResolved).map((blocker) => blocker.url), currentChecklistData?.internalQAPRList.filter((pr) => pr.isResolved).map((pr) => pr.url), didVersionChange ? false : currentChecklistData.isTimingDashboardChecked, didVersionChange ? false : currentChecklistData.isFirebaseChecked, didVersionChange ? false : currentChecklistData.isGHStatusChecked);
1154511548 if (stagingDeployCashBodyAndAssignees) {
1154611549 checklistBody = stagingDeployCashBodyAndAssignees.issueBody;
1154711550 checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean);
@@ -11643,37 +11646,14 @@ exports["default"] = CONST;
1164311646
1164411647"use strict";
1164511648
11646- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11647- if (k2 === undefined) k2 = k;
11648- var desc = Object.getOwnPropertyDescriptor(m, k);
11649- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11650- desc = { enumerable: true, get: function() { return m[k]; } };
11651- }
11652- Object.defineProperty(o, k2, desc);
11653- }) : (function(o, m, k, k2) {
11654- if (k2 === undefined) k2 = k;
11655- o[k2] = m[k];
11656- }));
11657- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
11658- Object.defineProperty(o, "default", { enumerable: true, value: v });
11659- }) : function(o, v) {
11660- o["default"] = v;
11661- });
11662- var __importStar = (this && this.__importStar) || function (mod) {
11663- if (mod && mod.__esModule) return mod;
11664- var result = {};
11665- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
11666- __setModuleDefault(result, mod);
11667- return result;
11668- };
1166911649var __importDefault = (this && this.__importDefault) || function (mod) {
1167011650 return (mod && mod.__esModule) ? mod : { "default": mod };
1167111651};
1167211652Object.defineProperty(exports, "__esModule", ({ value: true }));
1167311653const child_process_1 = __nccwpck_require__(2081);
1167411654const CONST_1 = __importDefault(__nccwpck_require__(9873));
1167511655const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(3902));
11676- const VersionUpdater = __importStar( __nccwpck_require__(8982) );
11656+ const versionUpdater_1 = __nccwpck_require__(8982);
1167711657/**
1167811658 * Check if a tag exists locally or in the remote.
1167911659 */
@@ -11721,15 +11701,20 @@ function tagExists(tag) {
1172111701 * @param level the Semver level to step backward by
1172211702 */
1172311703function getPreviousExistingTag(tag, level) {
11724- let previousVersion = VersionUpdater .getPreviousVersion(tag, level);
11704+ let previousVersion = (0, versionUpdater_1 .getPreviousVersion) (tag.replace('-staging', '') , level);
1172511705 let tagExistsForPreviousVersion = false;
1172611706 while (!tagExistsForPreviousVersion) {
1172711707 if (tagExists(previousVersion)) {
1172811708 tagExistsForPreviousVersion = true;
1172911709 break;
1173011710 }
11711+ if (tagExists(`${previousVersion}-staging`)) {
11712+ tagExistsForPreviousVersion = true;
11713+ previousVersion = `${previousVersion}-staging`;
11714+ break;
11715+ }
1173111716 console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`);
11732- previousVersion = VersionUpdater .getPreviousVersion(previousVersion, level);
11717+ previousVersion = (0, versionUpdater_1 .getPreviousVersion) (previousVersion, level);
1173311718 }
1173411719 return previousVersion;
1173511720}
@@ -11775,8 +11760,8 @@ function fetchTag(tag, shallowExcludeTag = '') {
1177511760 * Get merge logs between two tags (inclusive) as a JavaScript object.
1177611761 */
1177711762function getCommitHistoryAsJSON(fromTag, toTag) {
11778- // Fetch tags, excluding commits reachable from the previous patch version (i.e: previous checklist), so that we don't have to fetch the full history
11779- const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater. SEMANTIC_VERSION_LEVELS.PATCH);
11763+ // Fetch tags, excluding commits reachable from the previous patch version (or minor for prod) ( i.e: previous checklist), so that we don't have to fetch the full history
11764+ const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? versionUpdater_1. SEMANTIC_VERSION_LEVELS.PATCH : versionUpdater_1.SEMANTIC_VERSION_LEVELS.MINOR );
1178011765 fetchTag(fromTag, previousPatchVersion);
1178111766 fetchTag(toTag, previousPatchVersion);
1178211767 console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
@@ -11821,7 +11806,7 @@ function getValidMergedPRs(commits) {
1182111806 if (author === CONST_1.default.OS_BOTIFY) {
1182211807 return;
1182311808 }
11824- const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/);
11809+ const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-( staging|production) )/);
1182511810 if (!Array.isArray(match) || match.length < 2) {
1182611811 return;
1182711812 }
@@ -12002,7 +11987,7 @@ class GithubUtils {
1200211987 static getStagingDeployCashData(issue) {
1200311988 try {
1200411989 const versionRegex = new RegExp('([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9]+))?', 'g');
12005- const tag = issue.body?.match(versionRegex)?.[0].replace(/`/g, '');
11990+ const version = ( issue.body?.match(versionRegex)?.[0] ?? '') .replace(/`/g, '');
1200611991 return {
1200711992 title: issue.title,
1200811993 url: issue.url,
@@ -12014,7 +11999,8 @@ class GithubUtils {
1201411999 isTimingDashboardChecked: issue.body ? /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body) : false,
1201512000 isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false,
1201612001 isGHStatusChecked: issue.body ? /-\s\[x]\sI checked \[GitHub Status]/.test(issue.body) : false,
12017- tag,
12002+ version,
12003+ tag: `${version}-staging`,
1201812004 };
1201912005 }
1202012006 catch (exception) {
0 commit comments