diff --git a/tools/spec-gen-sdk/CHANGELOG.md b/tools/spec-gen-sdk/CHANGELOG.md index a35f4c4def6..fc5bd718eb2 100644 --- a/tools/spec-gen-sdk/CHANGELOG.md +++ b/tools/spec-gen-sdk/CHANGELOG.md @@ -1,5 +1,9 @@ # Release +## 2025-12-19 - 0.9.6 + +- Fixed a file accessing issue while the generation configuration is not enabled for .NET + ## 2025-12-18 - 0.9.5 - Override 'generateFromTypeSpec' value by the result in 'generateOutput.json' for .NET diff --git a/tools/spec-gen-sdk/package-lock.json b/tools/spec-gen-sdk/package-lock.json index c664d1a978f..ac2ccf2262d 100644 --- a/tools/spec-gen-sdk/package-lock.json +++ b/tools/spec-gen-sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@azure-tools/spec-gen-sdk", - "version": "0.9.5", + "version": "0.9.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@azure-tools/spec-gen-sdk", - "version": "0.9.5", + "version": "0.9.6", "license": "MIT", "dependencies": { "ajv": "^6.12.6", diff --git a/tools/spec-gen-sdk/package.json b/tools/spec-gen-sdk/package.json index ee14f1069d6..eadf8274f38 100644 --- a/tools/spec-gen-sdk/package.json +++ b/tools/spec-gen-sdk/package.json @@ -5,7 +5,7 @@ "email": "azsdkteam@microsoft.com", "url": "https://github.com/Azure/azure-sdk-tools" }, - "version": "0.9.5", + "version": "0.9.6", "description": "A TypeScript implementation of the API specification to SDK tool", "tags": [ "spec-gen-sdk" diff --git a/tools/spec-gen-sdk/src/automation/reportStatus.ts b/tools/spec-gen-sdk/src/automation/reportStatus.ts index 619e584eef0..f434abb7bca 100644 --- a/tools/spec-gen-sdk/src/automation/reportStatus.ts +++ b/tools/spec-gen-sdk/src/automation/reportStatus.ts @@ -7,7 +7,7 @@ import { vsoAddAttachment, vsoLogError, vsoLogWarning } from './logging'; import { ExecutionReport, PackageReport } from '../types/ExecutionReport'; import { deleteTmpJsonFile, readTmpJsonFile, writeTmpJsonFile } from '../utils/fsUtils'; import { marked } from "marked"; -import { externalError, toolError, toolWarning } from '../utils/messageUtils'; +import { toolError, toolWarning } from '../utils/messageUtils'; import { FailureType, WorkflowContext } from '../types/Workflow'; import { setFailureType } from '../utils/workflowUtils'; import { commentDetailView, renderHandlebarTemplate } from '../utils/reportStatusUtils'; @@ -83,16 +83,16 @@ export const generateReport = (context: WorkflowContext) => { } // for .NET SDK in spec PR scenario, override generateFromTypeSpec by the value returned from the .NET automation script - if (context.config.sdkName.includes('net') && context.config.runMode === 'spec-pull-request') { + if (context.config.sdkName.includes('net') && + context.config.runMode === 'spec-pull-request' && + fs.existsSync(path.join(context.tmpFolder, 'generateOutput.json'))) { generateFromTypeSpec = false; const generateOutputJson = readTmpJsonFile(context, 'generateOutput.json'); - if (generateOutputJson === undefined) { - message = externalError('Failed to read generateOutput.json. Please check if the generate script is configured correctly.'); - throw new Error(message); - } - const generateOutput = getGenerateOutput(generateOutputJson); - if (generateOutput?.packages?.[0]?.typespecProject) { - generateFromTypeSpec = true; + if (generateOutputJson !== undefined) { + const generateOutput = getGenerateOutput(generateOutputJson); + if (generateOutput?.packages?.[0]?.typespecProject) { + generateFromTypeSpec = true; + } } }