How to use the @codechecks/client.codechecks.isPr function in @codechecks/client

To help you get started, we’ve selected a few @codechecks/client 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 cgewecke / eth-gas-reporter / codechecks.js View on Github external
`Error: Couldn't load data from "${file}".\n` +
      `If you're using codechecks locally make sure you set ` +
      `the environment variable "CI" to "true" before running ` +
      `your tests. ( ex: CI=true npm test )`;

    console.log(message);
    return;
  }

  // Lets monorepo subcomponents individuate themselves
  output.namespace = options.name
    ? `${output.namespace}:${options.name}`
    : output.namespace;

  // Save new data on the merge commit / push build
  if (!codechecks.isPr()) {
    const report = new CodeChecksReport(output.config);
    report.generate(output.info);

    try {
      await codechecks.saveValue(output.namespace, report.newData);
      console.log(`Successful save: output.namespace was: ${output.namespace}`);
    } catch (err) {
      console.log(
        `If you have a chance, report this incident to the eth-gas-reporter github issues.`
      );
      console.log(`Codechecks errored running 'saveValue'...\n${err}\n`);
      console.log(`output.namespace was: ${output.namespace}`);
      console.log(`Saved gas-reporter data was: ${report.newData}`);
    }

    return;
github nestjs / nest / tools / benchmarks / check-benchmarks.ts View on Github external
export default async function checkBenchmarks() {
  const currentBenchmarks = await getBenchmarks();
  await codechecks.saveValue(benchmarksKey, currentBenchmarks);

  if (!codechecks.isPr()) {
    return;
  }
  const baselineBenchmarks = await codechecks.getValue(
    benchmarksKey,
  );
  const report = getCodechecksReport(currentBenchmarks, baselineBenchmarks);
  await codechecks.report(report);
}
github codechecks / build-size-watcher / src / index.ts View on Github external
const sizes = await Promise.all(matches.map(match => getSize(join(cwd, match), options.gzip)));
    const overallSize = sizes.reduce((a, b) => a + b, 0);

    const artifact: FileArtifact = {
      path: file.path,
      files: matches.length,
      overallSize,
    };

    fullArtifact[file.path] = artifact;
  }

  await codechecks.saveValue(options.artifactName, fullArtifact);

  if (!codechecks.isPr()) {
    return;
  }

  const baseArtifact = await codechecks.getValue(options.artifactName);

  const diff = getArtifactDiff(fullArtifact, baseArtifact);

  const report = getReportFromDiff(diff, options.files, options);
  await codechecks.report(report);
}