Skip to content

[No QA] Update CIGitLogicTest.ts for cherry pick to production #59739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 11 additions & 29 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11643,37 +11643,14 @@ exports["default"] = CONST;

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const child_process_1 = __nccwpck_require__(2081);
const CONST_1 = __importDefault(__nccwpck_require__(9873));
const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(3902));
const VersionUpdater = __importStar(__nccwpck_require__(8982));
const versionUpdater_1 = __nccwpck_require__(8982);
/**
* Check if a tag exists locally or in the remote.
*/
Expand Down Expand Up @@ -11721,15 +11698,20 @@ function tagExists(tag) {
* @param level the Semver level to step backward by
*/
function getPreviousExistingTag(tag, level) {
let previousVersion = VersionUpdater.getPreviousVersion(tag, level);
let previousVersion = (0, versionUpdater_1.getPreviousVersion)(tag.replace('-staging', ''), level);
let tagExistsForPreviousVersion = false;
while (!tagExistsForPreviousVersion) {
if (tagExists(previousVersion)) {
tagExistsForPreviousVersion = true;
break;
}
if (tagExists(`${previousVersion}-staging`)) {
tagExistsForPreviousVersion = true;
previousVersion = `${previousVersion}-staging`;
break;
}
console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`);
previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level);
previousVersion = (0, versionUpdater_1.getPreviousVersion)(previousVersion, level);
}
return previousVersion;
}
Expand Down Expand Up @@ -11775,8 +11757,8 @@ function fetchTag(tag, shallowExcludeTag = '') {
* Get merge logs between two tags (inclusive) as a JavaScript object.
*/
function getCommitHistoryAsJSON(fromTag, toTag) {
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH);
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? versionUpdater_1.SEMANTIC_VERSION_LEVELS.PATCH : versionUpdater_1.SEMANTIC_VERSION_LEVELS.MINOR);
fetchTag(fromTag, previousPatchVersion);
fetchTag(toTag, previousPatchVersion);
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
Expand Down Expand Up @@ -11821,7 +11803,7 @@ function getValidMergedPRs(commits) {
if (author === CONST_1.default.OS_BOTIFY) {
return;
}
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/);
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-(staging|production))/);
if (!Array.isArray(match) || match.length < 2) {
return;
}
Expand Down
40 changes: 11 additions & 29 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11684,37 +11684,14 @@ exports["default"] = CONST;

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const child_process_1 = __nccwpck_require__(2081);
const CONST_1 = __importDefault(__nccwpck_require__(9873));
const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(3902));
const VersionUpdater = __importStar(__nccwpck_require__(8982));
const versionUpdater_1 = __nccwpck_require__(8982);
/**
* Check if a tag exists locally or in the remote.
*/
Expand Down Expand Up @@ -11762,15 +11739,20 @@ function tagExists(tag) {
* @param level the Semver level to step backward by
*/
function getPreviousExistingTag(tag, level) {
let previousVersion = VersionUpdater.getPreviousVersion(tag, level);
let previousVersion = (0, versionUpdater_1.getPreviousVersion)(tag.replace('-staging', ''), level);
let tagExistsForPreviousVersion = false;
while (!tagExistsForPreviousVersion) {
if (tagExists(previousVersion)) {
tagExistsForPreviousVersion = true;
break;
}
if (tagExists(`${previousVersion}-staging`)) {
tagExistsForPreviousVersion = true;
previousVersion = `${previousVersion}-staging`;
break;
}
console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`);
previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level);
previousVersion = (0, versionUpdater_1.getPreviousVersion)(previousVersion, level);
}
return previousVersion;
}
Expand Down Expand Up @@ -11816,8 +11798,8 @@ function fetchTag(tag, shallowExcludeTag = '') {
* Get merge logs between two tags (inclusive) as a JavaScript object.
*/
function getCommitHistoryAsJSON(fromTag, toTag) {
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH);
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? versionUpdater_1.SEMANTIC_VERSION_LEVELS.PATCH : versionUpdater_1.SEMANTIC_VERSION_LEVELS.MINOR);
fetchTag(fromTag, previousPatchVersion);
fetchTag(toTag, previousPatchVersion);
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
Expand Down Expand Up @@ -11862,7 +11844,7 @@ function getValidMergedPRs(commits) {
if (author === CONST_1.default.OS_BOTIFY) {
return;
}
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/);
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-(staging|production))/);
if (!Array.isArray(match) || match.length < 2) {
return;
}
Expand Down
40 changes: 11 additions & 29 deletions .github/actions/javascript/getPreviousVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2808,37 +2808,14 @@ exports["default"] = CONST;

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const child_process_1 = __nccwpck_require__(81);
const CONST_1 = __importDefault(__nccwpck_require__(873));
const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(902));
const VersionUpdater = __importStar(__nccwpck_require__(982));
const versionUpdater_1 = __nccwpck_require__(982);
/**
* Check if a tag exists locally or in the remote.
*/
Expand Down Expand Up @@ -2886,15 +2863,20 @@ function tagExists(tag) {
* @param level the Semver level to step backward by
*/
function getPreviousExistingTag(tag, level) {
let previousVersion = VersionUpdater.getPreviousVersion(tag, level);
let previousVersion = (0, versionUpdater_1.getPreviousVersion)(tag.replace('-staging', ''), level);
let tagExistsForPreviousVersion = false;
while (!tagExistsForPreviousVersion) {
if (tagExists(previousVersion)) {
tagExistsForPreviousVersion = true;
break;
}
if (tagExists(`${previousVersion}-staging`)) {
tagExistsForPreviousVersion = true;
previousVersion = `${previousVersion}-staging`;
break;
}
console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`);
previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level);
previousVersion = (0, versionUpdater_1.getPreviousVersion)(previousVersion, level);
}
return previousVersion;
}
Expand Down Expand Up @@ -2940,8 +2922,8 @@ function fetchTag(tag, shallowExcludeTag = '') {
* Get merge logs between two tags (inclusive) as a JavaScript object.
*/
function getCommitHistoryAsJSON(fromTag, toTag) {
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH);
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? versionUpdater_1.SEMANTIC_VERSION_LEVELS.PATCH : versionUpdater_1.SEMANTIC_VERSION_LEVELS.MINOR);
fetchTag(fromTag, previousPatchVersion);
fetchTag(toTag, previousPatchVersion);
console.log('Getting pull requests merged between the following tags:', fromTag, toTag);
Expand Down Expand Up @@ -2986,7 +2968,7 @@ function getValidMergedPRs(commits) {
if (author === CONST_1.default.OS_BOTIFY) {
return;
}
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/);
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-(staging|production))/);
if (!Array.isArray(match) || match.length < 2) {
return;
}
Expand Down
17 changes: 11 additions & 6 deletions .github/libs/GitUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {execSync, spawn} from 'child_process';
import CONST from './CONST';
import sanitizeStringForJSONParse from './sanitizeStringForJSONParse';
import * as VersionUpdater from './versionUpdater';
import {getPreviousVersion, SEMANTIC_VERSION_LEVELS} from './versionUpdater';
import type {SemverLevel} from './versionUpdater';

type CommitType = {
Expand Down Expand Up @@ -55,15 +55,20 @@ function tagExists(tag: string) {
* @param level the Semver level to step backward by
*/
function getPreviousExistingTag(tag: string, level: SemverLevel) {
let previousVersion = VersionUpdater.getPreviousVersion(tag, level);
let previousVersion = getPreviousVersion(tag.replace('-staging', ''), level);
let tagExistsForPreviousVersion = false;
while (!tagExistsForPreviousVersion) {
if (tagExists(previousVersion)) {
tagExistsForPreviousVersion = true;
break;
}
if (tagExists(`${previousVersion}-staging`)) {
tagExistsForPreviousVersion = true;
previousVersion = `${previousVersion}-staging`;
break;
}
console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`);
previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level);
previousVersion = getPreviousVersion(previousVersion, level);
}
return previousVersion;
}
Expand Down Expand Up @@ -112,8 +117,8 @@ function fetchTag(tag: string, shallowExcludeTag = '') {
* Get merge logs between two tags (inclusive) as a JavaScript object.
*/
function getCommitHistoryAsJSON(fromTag: string, toTag: string): Promise<CommitType[]> {
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH);
// 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
const previousPatchVersion = getPreviousExistingTag(fromTag.replace('-staging', ''), fromTag.endsWith('-staging') ? SEMANTIC_VERSION_LEVELS.PATCH : SEMANTIC_VERSION_LEVELS.MINOR);
fetchTag(fromTag, previousPatchVersion);
fetchTag(toTag, previousPatchVersion);

Expand Down Expand Up @@ -164,7 +169,7 @@ function getValidMergedPRs(commits: CommitType[]): number[] {
return;
}

const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/);
const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-(staging|production))/);
if (!Array.isArray(match) || match.length < 2) {
return;
}
Expand Down
Loading
Loading