-
Notifications
You must be signed in to change notification settings - Fork 80
78 lines (66 loc) · 2.3 KB
/
validate-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Validate APIs
on:
pull_request:
branches:
- main
- 8.x
- '[0-9]+.[0-9]+'
jobs:
validate-pr:
name: build
runs-on: ubuntu-latest
steps:
- name: Check pull request was opened from branch
if: github.event.pull_request.head.repo.full_name != 'elastic/elasticsearch-specification'
run: echo "Validation is not supported from forks"; exit 1
- uses: actions/checkout@v4
with:
path: ./elasticsearch-specification
- uses: actions/checkout@v4
with:
repository: elastic/clients-flight-recorder
path: ./clients-flight-recorder
token: ${{ secrets.PAT }}
ref: main
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install deps 1/2
working-directory: ./clients-flight-recorder
run: |
npm install --prefix scripts/clone-elasticsearch
npm install --prefix scripts/upload-recording
npm install --prefix scripts/types-validator
- name: Install deps 2/2
working-directory: ./elasticsearch-specification
run: |
npm install --prefix .github/validate-pr
make setup
- name: Generate specification and check generated types
working-directory: ./elasticsearch-specification
run: |
make contrib
- name: Download artifacts
working-directory: ./clients-flight-recorder
run: |
if [[ -n "${GITHUB_BASE_REF+x}" ]]; then
branch=$GITHUB_BASE_REF
else
branch=$GITHUB_REF_NAME
fi
node scripts/upload-recording/download.js --branch $branch --git
node scripts/clone-elasticsearch/index.js --branch $branch
env:
GCS_CREDENTIALS: ${{ secrets.GCS_CREDENTIALS }}
- name: Remove previous comment
uses: maheshrayas/action-pr-comment-delete@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
org: elastic
repo: elasticsearch-specification
user: github-actions[bot]
issue: ${{ github.event.number }}
- name: Run validation
working-directory: ./elasticsearch-specification
run: node .github/validate-pr --token ${{ secrets.GITHUB_TOKEN }}