Skip to content

Fail CI on generation errors #2614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .github/validate-pr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion typescript-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Loading