Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com>
This commit is contained in:
matt korwel
2025-09-19 03:27:47 -07:00
committed by GitHub
parent 8af1439697
commit 5f5e07e6cc

View File

@@ -95,29 +95,33 @@ async function main() {
console.log( console.log(
`Release branch ${releaseBranch} does not exist. Creating it from tag ${latestTag}...`, `Release branch ${releaseBranch} does not exist. Creating it from tag ${latestTag}...`,
); );
try { try {
run(`git checkout -b ${releaseBranch} ${latestTag}`, dryRun); run(`git checkout -b ${releaseBranch} ${latestTag}`, dryRun);
run(`git push origin ${releaseBranch}`, dryRun); run(`git push origin ${releaseBranch}`, dryRun);
} catch (error) { } catch (error) {
console.log(`Failed to push release branch with git (likely due to workflow file permissions): ${error.message}`); // Check if this is a GitHub App workflows permission error
console.log(`Attempting to create release branch using GitHub API instead...`); if (
/refusing to allow a GitHub App.*workflows?['`]? permission/i.test(
if (!dryRun) { error.message,
try { )
// Get the tag SHA ) {
const tagSha = run(`git rev-parse ${latestTag}`, false); console.error(
`❌ Failed to create release branch due to insufficient GitHub App permissions.`,
// Create branch using GitHub API );
const repo = process.env.GITHUB_REPOSITORY || 'google-gemini/gemini-cli'; console.log(
const [owner, repoName] = repo.split('/'); `\n📋 Please run these commands manually to create the branch:`,
);
run(`gh api repos/${owner}/${repoName}/git/refs --method POST --field ref="refs/heads/${releaseBranch}" --field sha="${tagSha.trim()}"`, false); console.log(`\n\`\`\`bash`);
console.log(`✅ Successfully created release branch ${releaseBranch} using GitHub API`); console.log(`git checkout -b ${releaseBranch} ${latestTag}`);
} catch (apiError) { console.log(`git push origin ${releaseBranch}`);
console.error(`Failed to create release branch using GitHub API: ${apiError.message}`); console.log(`\`\`\``);
throw new Error(`Cannot create release branch ${releaseBranch}. Both git push and GitHub API failed.`); console.log(
} `\nAfter running these commands, you can run the patch command again.`,
);
process.exit(1);
} else {
// Re-throw other errors
throw error;
} }
} }
} else { } else {