mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Reset 2 (#8898)
Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -29,44 +29,18 @@ async function main() {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('skip-pr-creation', {
|
||||
description: 'Only create branches, skip PR creation.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('pr-only', {
|
||||
description: 'Only create PR, skip branch creation.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.help()
|
||||
.alias('help', 'h').argv;
|
||||
|
||||
const { commit, channel, dryRun, skipPrCreation, prOnly } = argv;
|
||||
|
||||
// Validate mutually exclusive flags
|
||||
if (skipPrCreation && prOnly) {
|
||||
console.error(
|
||||
'Error: --skip-pr-creation and --pr-only are mutually exclusive.',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
const { commit, channel, dryRun } = argv;
|
||||
|
||||
console.log(`Starting patch process for commit: ${commit}`);
|
||||
console.log(`Targeting channel: ${channel}`);
|
||||
if (dryRun) {
|
||||
console.log('Running in dry-run mode.');
|
||||
}
|
||||
if (skipPrCreation) {
|
||||
console.log('Mode: Branch creation only (skipping PR creation)');
|
||||
}
|
||||
if (prOnly) {
|
||||
console.log('Mode: PR creation only (skipping branch creation)');
|
||||
}
|
||||
|
||||
if (!prOnly) {
|
||||
run('git fetch --all --tags --prune', dryRun);
|
||||
}
|
||||
run('git fetch --all --tags --prune', dryRun);
|
||||
|
||||
const latestTag = getLatestTag(channel);
|
||||
console.log(`Found latest tag for ${channel}: ${latestTag}`);
|
||||
@@ -74,22 +48,6 @@ async function main() {
|
||||
const releaseBranch = `release/${latestTag}`;
|
||||
const hotfixBranch = `hotfix/${latestTag}/${channel}/cherry-pick-${commit.substring(0, 7)}`;
|
||||
|
||||
// If PR-only mode, skip all branch creation logic
|
||||
if (prOnly) {
|
||||
console.log(
|
||||
'PR-only mode: Skipping branch creation, proceeding to PR creation...',
|
||||
);
|
||||
// Jump to PR creation section
|
||||
return await createPullRequest(
|
||||
hotfixBranch,
|
||||
releaseBranch,
|
||||
commit,
|
||||
channel,
|
||||
dryRun,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
// Create the release branch from the tag if it doesn't exist.
|
||||
if (!branchExists(releaseBranch)) {
|
||||
console.log(
|
||||
@@ -101,9 +59,8 @@ async function main() {
|
||||
} catch (error) {
|
||||
// Check if this is a GitHub App workflows permission error
|
||||
if (
|
||||
/refusing to allow a GitHub App.*workflows?['`]? permission/i.test(
|
||||
error.message,
|
||||
)
|
||||
error.message.match(/refusing to allow a GitHub App/i) &&
|
||||
error.message.match(/workflows?['`]? permission/i)
|
||||
) {
|
||||
console.error(
|
||||
`❌ Failed to create release branch due to insufficient GitHub App permissions.`,
|
||||
@@ -223,43 +180,7 @@ async function main() {
|
||||
console.log(`Pushing hotfix branch ${hotfixBranch} to origin...`);
|
||||
run(`git push --set-upstream origin ${hotfixBranch}`, dryRun);
|
||||
|
||||
// If skip-pr-creation mode, stop here
|
||||
if (skipPrCreation) {
|
||||
console.log(
|
||||
'✅ Branch creation completed! Skipping PR creation as requested.',
|
||||
);
|
||||
if (hasConflicts) {
|
||||
console.log(
|
||||
'⚠️ Note: Conflicts were detected during cherry-pick - manual resolution required before PR creation!',
|
||||
);
|
||||
}
|
||||
return {
|
||||
newBranch: hotfixBranch,
|
||||
created: true,
|
||||
hasConflicts,
|
||||
skippedPR: true,
|
||||
};
|
||||
}
|
||||
|
||||
// Create the pull request
|
||||
return await createPullRequest(
|
||||
hotfixBranch,
|
||||
releaseBranch,
|
||||
commit,
|
||||
channel,
|
||||
dryRun,
|
||||
hasConflicts,
|
||||
);
|
||||
}
|
||||
|
||||
async function createPullRequest(
|
||||
hotfixBranch,
|
||||
releaseBranch,
|
||||
commit,
|
||||
channel,
|
||||
dryRun,
|
||||
hasConflicts,
|
||||
) {
|
||||
// Create the pull request.
|
||||
console.log(
|
||||
`Creating pull request from ${hotfixBranch} to ${releaseBranch}...`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user