How to use the @auto-it/core.getCurrentBranch function in @auto-it/core

To help you get started, we’ve selected a few @auto-it/core 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 intuit / auto / plugins / npm / src / index.ts View on Github external
apply(auto: Auto) {
    const isVerbose =
      auto.logger.logLevel === 'verbose' ||
      auto.logger.logLevel === 'veryVerbose';
    const verboseArgs = isVerbose ? verbose : [];
    const prereleaseBranches = auto.config?.prereleaseBranches!;
    const branch = getCurrentBranch();
    // if ran from master we publish the prerelease to the first
    // configured prerelease branch
    const prereleaseBranch =
      branch && prereleaseBranches.includes(branch)
        ? branch
        : prereleaseBranches[0];

    auto.hooks.beforeShipIt.tap(this.name, async () => {
      if (!isCi) {
        return;
      }

      auto.checkEnv(this.name, 'NPM_TOKEN');
    });

    auto.hooks.getAuthor.tapPromise(this.name, async () => {
github intuit / auto / plugins / git-tag / src / index.ts View on Github external
auto.hooks.next.tapPromise(this.name, async (preReleaseVersions, bump) => {
      if (!auto.git) {
        return preReleaseVersions;
      }

      const prereleaseBranches = auto.config?.prereleaseBranches!;
      const branch = getCurrentBranch() || '';
      const prereleaseBranch = prereleaseBranches.includes(branch)
        ? branch
        : prereleaseBranches[0];
      const lastRelease = await auto.git.getLatestRelease();
      const current =
        (await auto.git.getLastTagNotInBaseBranch(prereleaseBranch)) ||
        (await auto.getCurrentVersion(lastRelease));
      const prerelease = determineNextVersion(
        lastRelease,
        current,
        bump,
        prereleaseBranch
      );

      await execPromise('git', ['tag', prerelease]);
      await execPromise('git', ['push', '--tags']);
github intuit / auto / plugins / git-tag / src / index.ts View on Github external
auto.hooks.version.tapPromise(this.name, async version => {
      if (!auto.git) {
        return;
      }

      const lastTag = await auto.git.getLatestTagInBranch();
      const newTag = inc(lastTag, version as ReleaseType);
      const branch = getCurrentBranch() || '';

      if (!newTag) {
        return;
      }

      await execPromise('git', ['tag', newTag]);
      await execPromise('git', [
        'push',
        '--follow-tags',
        '--set-upstream',
        'origin',
        branch || auto.baseBranch
      ]);
    });