@@ -80178,17 +80178,56 @@ exports.collectAnHTTPQuotedString = (input, position) => {
8017880178/***/ }),
8017980179
8018080180/***/ 26454:
80181- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
80181+ /***/ (function (__unused_webpack_module, exports, __nccwpck_require__) {
8018280182
8018380183"use strict";
8018480184
80185+ var __importDefault = (this && this.__importDefault) || function (mod) {
80186+ return (mod && mod.__esModule) ? mod : { "default": mod };
80187+ };
8018580188Object.defineProperty(exports, "__esModule", ({ value: true }));
8018680189exports.executeAction = executeAction;
80190+ const promises_1 = __nccwpck_require__(51455);
80191+ const node_path_1 = __importDefault(__nccwpck_require__(76760));
8018780192const pr_body_1 = __nccwpck_require__(62706);
8018880193const DEFAULT_IGNORES = ['**/node_modules/**', '**/.git/**', '**/dist/**'];
8018980194function uniqueFiles(matches) {
8019080195 return Array.from(new Set(matches.map((match) => match.file))).sort();
8019180196}
80197+ function groupMatchesByFile(matches) {
80198+ const grouped = new Map();
80199+ for (const match of matches) {
80200+ const existing = grouped.get(match.file);
80201+ if (existing) {
80202+ existing.push(match);
80203+ }
80204+ else {
80205+ grouped.set(match.file, [match]);
80206+ }
80207+ }
80208+ return grouped;
80209+ }
80210+ async function applyVersionUpdates(workspace, groupedMatches, newVersion) {
80211+ for (const [relativePath, fileMatches] of groupedMatches) {
80212+ const absolutePath = node_path_1.default.join(workspace, relativePath);
80213+ const originalContent = await (0, promises_1.readFile)(absolutePath, 'utf8');
80214+ const sortedMatches = [...fileMatches].sort((a, b) => b.index - a.index);
80215+ let updatedContent = originalContent;
80216+ let changed = false;
80217+ for (const match of sortedMatches) {
80218+ if (match.matched === newVersion) {
80219+ continue;
80220+ }
80221+ const start = match.index;
80222+ const end = start + match.matched.length;
80223+ updatedContent = updatedContent.slice(0, start) + newVersion + updatedContent.slice(end);
80224+ changed = true;
80225+ }
80226+ if (changed && updatedContent !== originalContent) {
80227+ await (0, promises_1.writeFile)(absolutePath, updatedContent, 'utf8');
80228+ }
80229+ }
80230+ }
8019280231function determineMissingRunners(availability) {
8019380232 if (!availability) {
8019480233 return ['linux', 'mac', 'win'];
@@ -80328,6 +80367,7 @@ async function executeAction(options, dependencies) {
8032880367 };
8032980368 }
8033080369 const filesChanged = uniqueFiles(matchesNeedingUpdate);
80370+ const groupedMatches = groupMatchesByFile(matchesNeedingUpdate);
8033180371 if (dryRun || !allowPrCreation) {
8033280372 return {
8033380373 status: 'success',
@@ -80336,6 +80376,14 @@ async function executeAction(options, dependencies) {
8033680376 dryRun: true,
8033780377 };
8033880378 }
80379+ if (!dependencies.createBranchAndCommit || !dependencies.pushBranch) {
80380+ return {
80381+ status: 'success',
80382+ newVersion: latestVersion,
80383+ filesChanged,
80384+ dryRun: false,
80385+ };
80386+ }
8033980387 if (!githubToken || !repository) {
8034080388 return {
8034180389 status: 'success',
@@ -80371,17 +80419,36 @@ async function executeAction(options, dependencies) {
8037180419 };
8037280420 }
8037380421 try {
80422+ await applyVersionUpdates(workspace, groupedMatches, latestVersion);
80423+ const commitResult = await dependencies.createBranchAndCommit({
80424+ repoPath: workspace,
80425+ track,
80426+ files: filesChanged,
80427+ commitMessage: `chore: bump python ${track} to ${latestVersion}`,
80428+ });
80429+ if (!commitResult.commitCreated) {
80430+ return {
80431+ status: 'success',
80432+ newVersion: latestVersion,
80433+ filesChanged,
80434+ dryRun: false,
80435+ };
80436+ }
80437+ await dependencies.pushBranch({
80438+ repoPath: workspace,
80439+ branch: commitResult.branch,
80440+ });
8037480441 const prBody = (0, pr_body_1.generatePullRequestBody)({
8037580442 track,
8037680443 newVersion: latestVersion,
8037780444 filesChanged,
80378- branchName,
80445+ branchName: commitResult.branch ,
8037980446 defaultBranch,
8038080447 });
8038180448 const pullRequest = await dependencies.createOrUpdatePullRequest({
8038280449 owner: repository.owner,
8038380450 repo: repository.repo,
80384- head: branchName ,
80451+ head: commitResult.branch ,
8038580452 base: defaultBranch,
8038680453 title: `chore: bump python ${track} to ${latestVersion}`,
8038780454 body: prBody,
@@ -80442,6 +80509,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8044280509};
8044380510Object.defineProperty(exports, "__esModule", ({ value: true }));
8044480511exports.createBranchAndCommit = createBranchAndCommit;
80512+ exports.pushBranch = pushBranch;
8044580513const node_child_process_1 = __nccwpck_require__(31421);
8044680514const node_process_1 = __importDefault(__nccwpck_require__(1708));
8044780515const node_util_1 = __nccwpck_require__(57975);
@@ -80510,6 +80578,18 @@ async function createBranchAndCommit(options) {
8051080578 });
8051180579 return { branch, commitCreated: true, filesCommitted: stagedFiles };
8051280580}
80581+ async function pushBranch(options) {
80582+ const { repoPath, branch, remote = 'origin', forceWithLease = true, setUpstream = true, } = options;
80583+ const args = ['push'];
80584+ if (setUpstream) {
80585+ args.push('--set-upstream');
80586+ }
80587+ if (forceWithLease) {
80588+ args.push('--force-with-lease');
80589+ }
80590+ args.push(remote, branch);
80591+ await runGit(args, repoPath);
80592+ }
8051380593
8051480594
8051580595/***/ }),
@@ -80520,9 +80600,10 @@ async function createBranchAndCommit(options) {
8052080600"use strict";
8052180601
8052280602Object.defineProperty(exports, "__esModule", ({ value: true }));
80523- exports.findExistingPullRequest = exports.createOrUpdatePullRequest = exports.createBranchAndCommit = void 0;
80603+ exports.findExistingPullRequest = exports.createOrUpdatePullRequest = exports.pushBranch = exports. createBranchAndCommit = void 0;
8052480604var branch_1 = __nccwpck_require__(28030);
8052580605Object.defineProperty(exports, "createBranchAndCommit", ({ enumerable: true, get: function () { return branch_1.createBranchAndCommit; } }));
80606+ Object.defineProperty(exports, "pushBranch", ({ enumerable: true, get: function () { return branch_1.pushBranch; } }));
8052680607var pull_request_1 = __nccwpck_require__(10689);
8052780608Object.defineProperty(exports, "createOrUpdatePullRequest", ({ enumerable: true, get: function () { return pull_request_1.createOrUpdatePullRequest; } }));
8052880609Object.defineProperty(exports, "findExistingPullRequest", ({ enumerable: true, get: function () { return pull_request_1.findExistingPullRequest; } }));
@@ -80895,6 +80976,8 @@ function buildDependencies() {
8089580976 fetchLatestFromPythonOrg: versioning_1.fetchLatestFromPythonOrg,
8089680977 enforcePreReleaseGuard: versioning_1.enforcePreReleaseGuard,
8089780978 fetchRunnerAvailability: versioning_1.fetchRunnerAvailability,
80979+ createBranchAndCommit: git_1.createBranchAndCommit,
80980+ pushBranch: git_1.pushBranch,
8089880981 findExistingPullRequest: git_1.findExistingPullRequest,
8089980982 createOrUpdatePullRequest: git_1.createOrUpdatePullRequest,
8090080983 fetchReleaseNotes: versioning_1.fetchReleaseNotes,
0 commit comments