Skip to content

Commit 2953c5d

Browse files
authored
fix(workspace-plugin): properly resolve isCi on ADO (#33165)
1 parent e1644c3 commit 2953c5d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

tools/workspace-plugin/src/executors/generate-api/executor.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { type TsConfig } from '../../types';
1212

1313
import { type GenerateApiExecutorSchema } from './schema';
1414
import executor from './executor';
15+
import { isCI } from './lib/shared';
1516

1617
// =========== mocks START
1718
import { execSync } from 'node:child_process';
@@ -169,8 +170,11 @@ describe('GenerateApi Executor', () => {
169170
skipLibCheck: false,
170171
});
171172
expect(extractorConfig.skipLibCheck).toBe(false);
173+
174+
const actualLocalBuildValue = isCI() ? false : true;
175+
172176
expect(extractorArgs).toEqual({
173-
localBuild: true,
177+
localBuild: actualLocalBuildValue,
174178
showDiagnostics: false,
175179
showVerboseMessages: true,
176180
});

tools/workspace-plugin/src/executors/generate-api/executor.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Extractor, ExtractorConfig, type IConfigFile } from '@microsoft/api-ext
88
import type { GenerateApiExecutorSchema } from './schema';
99
import type { PackageJson, TsConfig } from '../../types';
1010
import { measureEnd, measureStart } from '../../utils';
11+
import { isCI } from './lib/shared';
1112

1213
const runExecutor: PromiseExecutor<GenerateApiExecutorSchema> = async (schema, context) => {
1314
measureStart('GenerateApiExecutor');
@@ -67,14 +68,6 @@ function normalizeOptions(schema: GenerateApiExecutorSchema, context: ExecutorCo
6768
tsConfigPathForCompilation: tsConfigPathForCompilation.result!,
6869
packageJsonPath,
6970
};
70-
71-
function isCI() {
72-
return (
73-
(process.env.CI && process.env.CI !== 'false') ||
74-
process.env.TF_BUILD === 'true' ||
75-
process.env.GITHUB_ACTIONS === 'true'
76-
);
77-
}
7871
}
7972

8073
function generateTypeDeclarations(options: NormalizedOptions) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function isCI() {
2+
return (
3+
(process.env.CI && process.env.CI !== 'false') ||
4+
(process.env.TF_BUILD && process.env.TF_BUILD.toLowerCase() === 'true') ||
5+
process.env.GITHUB_ACTIONS === 'true'
6+
);
7+
}

0 commit comments

Comments
 (0)