Skip to content

Commit

Permalink
fix git check: back on top (#2329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-Herve authored Sep 21, 2023
1 parent 21b2265 commit e4960c4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions projects/optic/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { compute } from './diff/compute';
import { uploadDiff } from './diff/upload-diff';
import chalk from 'chalk';
import { alias, flushEvents, trackEvent } from '../segment';
import { flushEvents, trackEvent } from '../segment';
import { BreakingChangesRuleset } from '@useoptic/standard-rulesets';
import { createOpticClient } from '../client/optic-backend';
import fs from 'fs';
Expand Down Expand Up @@ -114,7 +114,7 @@ export function registerRunCommand(cli: Command, config: OpticCliConfig) {
cli
.command('run')
.description(
`Optic's workflow command: lint OpenAPI specifications, search for breaking changes, enforce custom API governance rules, automatically update your specs to match your tests traffic and post a friendly summary to the PR/MR and .`
`Optic's workflow command: run lint rules, breaking change checks, and spec validation. Posts the results to PR/MRs when run in CI.`
)
.configureHelp({ commandUsage: usage })
.option(
Expand Down Expand Up @@ -291,21 +291,10 @@ export const getRunAction =
const commentToken =
process.env.GITHUB_TOKEN ?? process.env.OPTIC_GITLAB_TOKEN;

const currentBranch =
getGithubBranchName() ??
process.env.CI_COMMIT_REF_NAME ??
(await getCurrentBranchName());

const currentBranchCloudTag = `gitbranch:${currentBranch}`;

const baseBranch =
process.env.GITHUB_BASE_REF ??
process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;

const cloudTag = baseBranch
? `gitbranch:${baseBranch}`
: currentBranchCloudTag;

const isPR = config.isInCi && !!baseBranch;

trackEvent(
Expand Down Expand Up @@ -334,6 +323,17 @@ export const getRunAction =
return;
}

const currentBranch =
getGithubBranchName() ??
process.env.CI_COMMIT_REF_NAME ??
(await getCurrentBranchName());

const currentBranchCloudTag = `gitbranch:${currentBranch}`;

const cloudTag = baseBranch
? `gitbranch:${baseBranch}`
: currentBranchCloudTag;

const authentified = config.isInCi
? await authenticateCI(config)
: await authenticateInteractive(config);
Expand Down

0 comments on commit e4960c4

Please sign in to comment.