Skip to content

Commit

Permalink
fix(workspace-plugin): properly resolve isCi on ADO (#33165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotell authored Oct 29, 2024
1 parent e1644c3 commit 2953c5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { type TsConfig } from '../../types';

import { type GenerateApiExecutorSchema } from './schema';
import executor from './executor';
import { isCI } from './lib/shared';

// =========== mocks START
import { execSync } from 'node:child_process';
Expand Down Expand Up @@ -169,8 +170,11 @@ describe('GenerateApi Executor', () => {
skipLibCheck: false,
});
expect(extractorConfig.skipLibCheck).toBe(false);

const actualLocalBuildValue = isCI() ? false : true;

expect(extractorArgs).toEqual({
localBuild: true,
localBuild: actualLocalBuildValue,
showDiagnostics: false,
showVerboseMessages: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Extractor, ExtractorConfig, type IConfigFile } from '@microsoft/api-ext
import type { GenerateApiExecutorSchema } from './schema';
import type { PackageJson, TsConfig } from '../../types';
import { measureEnd, measureStart } from '../../utils';
import { isCI } from './lib/shared';

const runExecutor: PromiseExecutor<GenerateApiExecutorSchema> = async (schema, context) => {
measureStart('GenerateApiExecutor');
Expand Down Expand Up @@ -67,14 +68,6 @@ function normalizeOptions(schema: GenerateApiExecutorSchema, context: ExecutorCo
tsConfigPathForCompilation: tsConfigPathForCompilation.result!,
packageJsonPath,
};

function isCI() {
return (
(process.env.CI && process.env.CI !== 'false') ||
process.env.TF_BUILD === 'true' ||
process.env.GITHUB_ACTIONS === 'true'
);
}
}

function generateTypeDeclarations(options: NormalizedOptions) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function isCI() {
return (
(process.env.CI && process.env.CI !== 'false') ||
(process.env.TF_BUILD && process.env.TF_BUILD.toLowerCase() === 'true') ||
process.env.GITHUB_ACTIONS === 'true'
);
}

0 comments on commit 2953c5d

Please sign in to comment.