Skip to content

Commit

Permalink
do not hard code default branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jul 22, 2024
1 parent 549ac8e commit 4bd64c9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/promote_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ export default class ReleasePromotion extends Session {
}

// Push to the remote default branch
const shouldPushDefaultBranch = await cli.prompt('Push to main?',
const shouldPushDefaultBranch = await cli.prompt(`Push to ${this.branch}?`,
{ defaultAnswer: true });
if (!shouldPushDefaultBranch) {
cli.warn(`Aborting release promotion for version ${version}`);
throw new Error('Aborted');
}
if (this.dryRun) {
cli.info('Skipping pushing to main in dry-run mode');
cli.info(`Skipping pushing to ${this.branch} in dry-run mode`);
} else {
await forceRunAsync('git', ['push', this.upstream, 'HEAD:main'], { ignoreFailure: false });
await forceRunAsync('git', ['push', this.upstream, this.branch], { ignoreFailure: false });
}

// Push release tag.
Expand Down Expand Up @@ -392,9 +392,9 @@ export default class ReleasePromotion extends Session {
const releaseBranch = `v${versionComponents.major}.x`;

return Promise.all([
forceRunAsync('git', ['push', this.upstream, `HEAD:${releaseBranch}`],
forceRunAsync('git', ['push', this.upstream, `HEAD:refs/heads/${releaseBranch}`],
{ ignoreFailure: false }),
forceRunAsync('git', ['push', this.upstream, `HEAD:${stagingBranch}`,
forceRunAsync('git', ['push', this.upstream, `HEAD:refs/heads/${stagingBranch}`,
{ ignoreFailure: false }])
]);
}
Expand All @@ -421,7 +421,7 @@ export default class ReleasePromotion extends Session {

async cherryPickToDefaultBranch() {
const releaseCommitSha = this.releaseCommitSha;
await forceRunAsync('git', ['checkout', 'main'], { ignoreFailure: false });
await forceRunAsync('git', ['checkout', this.branch], { ignoreFailure: false });

await this.tryResetBranch();

Expand Down

0 comments on commit 4bd64c9

Please sign in to comment.