How to use the @ts-common/azure-js-dev-tools.gitStatus function in @ts-common/azure-js-dev-tools

To help you get started, we’ve selected a few @ts-common/azure-js-dev-tools 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 Azure / azure-sdk-for-js / gulpfile.ts View on Github external
let upToDatePackages = 0;
  let packedPackages = 0;
  let skippedPackages = 0;

  const changedFiles: string[] = [];

  if (toPack === PackagesToPack.BranchHasChanges) {
    let packBaseReference: string | undefined = baseReference;
    if (!packBaseReference) {
      packBaseReference = "master";
      _logger.log(`No base-reference argument specified on command line or in environment variables. Defaulting to "${packBaseReference}".`);
    }

    let packHeadReference: string | undefined = headReference;
    if (!packHeadReference) {
      const statusResult: GitStatusResult = gitStatus(runOptions);
      packHeadReference = statusResult.localBranch!;
      _logger.log(`No head-reference argument specified on command line or in environment variables. Defaulting to "${packHeadReference}".`);

      const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
      if (modifiedFiles) {
        changedFiles.push(...modifiedFiles);
      }
    }

    if (packBaseReference === packHeadReference) {
      if (rawToPack) {
        _logger.logWarn(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}". This will result in nothing getting packed because there won't be any changes detected. Please change either the base or head-reference.`);
      } else {
        toPack = PackagesToPack.DifferentVersion;
        _logger.log(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}" which means there won't be any changes to pack. Switching "to-pack" to be "${PackagesToPack[toPack]}".`);
      }
github Azure / azure-sdk-for-js / .scripts / checkEverything.ts View on Github external
import { checkEverything, contains, getArgument, getDefaultLogger, gitDiff, GitDiffResult, gitStatus, GitStatusResult, joinPath, Logger, normalize, resolvePath } from "@ts-common/azure-js-dev-tools";
import * as path from "path";
import { getPackageFolderPaths } from "./common";

const logger: Logger = getDefaultLogger();
const changedFiles: string[] = [];

let headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
if (!headReference) {
  const statusResult: GitStatusResult = gitStatus();
  headReference = statusResult.localBranch!;
  logger.logInfo(`No head-reference argument specified on command line or in environment variables. Defaulting to "${headReference}".`);

  const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
  if (modifiedFiles) {
    changedFiles.push(...modifiedFiles);
  }
}

let baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });
if (!baseReference) {
  baseReference = "master";
  logger.logInfo(`No base-reference argument specified on command line or in environment variables. Defaulting to "${baseReference}".`);
}

if (baseReference !== headReference) {