diff --git a/.github/validate-pr/index.js b/.github/validate-pr/index.js index b4a59b6936..53dc3dec79 100644 --- a/.github/validate-pr/index.js +++ b/.github/validate-pr/index.js @@ -107,20 +107,22 @@ async function run () { return 0 }) - let comment = `Following you can find the validation results for the API${table.length === 1 ? '' : 's'} you have changed.\n\n` - comment += '| API | Status | Request | Response |\n' - comment += '| --- | --- | --- | --- |\n' - for (const line of [...new Set(table)]) { - comment += line - } - comment += `\nYou can validate ${table.length === 1 ? 'this' : 'these'} API${table.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n` + if (table.length > 0) { + let comment = `Following you can find the validation results for the API${table.length === 1 ? '' : 's'} you have changed.\n\n` + comment += '| API | Status | Request | Response |\n' + comment += '| --- | --- | --- | --- |\n' + for (const line of [...new Set(table)]) { + comment += line + } + comment += `\nYou can validate ${table.length === 1 ? 'this' : 'these'} API${table.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n` - await octokit.rest.issues.createComment({ - owner: 'elastic', - repo: 'elasticsearch-specification', - issue_number: context.payload.pull_request.number, - body: comment - }) + await octokit.rest.issues.createComment({ + owner: 'elastic', + repo: 'elasticsearch-specification', + issue_number: context.payload.pull_request.number, + body: comment + }) + } core.info('Done!') } diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 0b388ddc72..b76165ab4d 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -2,13 +2,6 @@ name: Validate APIs on: pull_request: - paths: - - 'specification/**' - - '!specification/_types/**' - - '!specification/_spec_utils/**' - - '!specification/_doc_ids/**' - - '!specification/_json_spec/**' - branches: - main @@ -51,6 +44,11 @@ jobs: npm install --prefix .github/validate-pr make setup + - name: Generate specification and check generated types + working-directory: ./elasticsearch-specification + run: | + make generate + - name: Download artifacts working-directory: ./clients-flight-recorder run: | diff --git a/typescript-generator/package.json b/typescript-generator/package.json index b3c0bdbe63..0dad5b09ec 100644 --- a/typescript-generator/package.json +++ b/typescript-generator/package.json @@ -10,7 +10,7 @@ "kibana": "KIBANA=true ts-node src/client.ts", "lint": "ts-standard src", "lint:fix": "ts-standard --fix src", - "is-valid-output": "tsc --noEmit", + "is-valid-output": "tsc --noEmit ../output/typescript/types.ts", "test": "npm run lint", "build": "rm -rf lib && tsc" },