How to use the shipjs-lib.hasRemoteBranch function in shipjs-lib

To help you get started, we’ve selected a few shipjs-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / shipjs / packages / shipjs / src / step / prepare / prepareStagingBranch.js View on Github external
runStep({ title: 'Preparing a staging branch' }, () => {
    const { getStagingBranchName, remote } = config;
    const stagingBranch = getStagingBranchName({ nextVersion, releaseType });
    if (hasLocalBranch(stagingBranch, dir)) {
      print(error(`The branch "${stagingBranch}" already exists locally.`));
      print('Delete the local branch and try again. For example,');
      print(`  $ git branch -d ${stagingBranch}`);
      exitProcess(1);
    }
    if (hasRemoteBranch(remote, stagingBranch, dir)) {
      print(error(`The branch "${stagingBranch}" already exists remotely.`));
      print('Delete the remote branch and try again. For example,');
      print(`  $ git push ${remote} :${stagingBranch}`);
      exitProcess(1);
    }
    return { stagingBranch };
  });
github algolia / shipjs / packages / shipjs / src / step / prepare / createPullRequest.js View on Github external
const {
      mergeStrategy,
      formatPullRequestTitle,
      formatPullRequestMessage,
      publishCommand,
      pullRequestReviewer,
      remote,
      monorepo,
    } = config;
    const destinationBranch = getDestinationBranchName({
      baseBranch,
      mergeStrategy,
    });
    if (
      baseBranch !== destinationBranch &&
      !hasRemoteBranch(remote, destinationBranch, dir)
    ) {
      print(warning('You want to release using a dedicated release branch.'));
      print(
        warning(
          `The name of the branch is \`${destinationBranch}\`, but you don't have it yet.`
        )
      );
      print(warning('Create that branch pointing to a latest stable commit.'));
      print(warning('After that, try again.'));
      print('');
      print(warning('Rolling back for now...'));
      run({ command: `git checkout ${baseBranch}`, dir, dryRun });
      run({ command: `git branch -D ${stagingBranch}`, dir, dryRun });
      exitProcess(0);
    }
    const { url: repoURL, owner, name: repo } = getRepoInfo(remote, dir);