-
Notifications
You must be signed in to change notification settings - Fork 18
166 lines (142 loc) · 5.63 KB
/
Copy pathupdate-api-docs.yml
File metadata and controls
166 lines (142 loc) · 5.63 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Update API Docs
on:
workflow_dispatch:
inputs:
api:
description: 'Which API to update'
required: true
default: 'both'
type: choice
options:
- both
- live
- query
repository_dispatch:
types: [live-api-update, query-api-update]
permissions:
contents: write
pull-requests: write
jobs:
live-api-update:
if: >
github.event_name == 'repository_dispatch' && github.event.action == 'live-api-update' ||
github.event_name == 'workflow_dispatch' && (github.event.inputs.api == 'live' || github.event.inputs.api == 'both')
runs-on: ubuntu-latest
concurrency:
group: live-api-update
cancel-in-progress: true
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
- name: Checkout qubic-http
uses: actions/checkout@v4
with:
repository: qubic/qubic-http
ref: ${{ github.event.client_payload.ref || 'main' }}
path: qubic-http
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.26.x
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Install protoc-gen-openapi
run: go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
- name: Generate OpenAPI spec
working-directory: qubic-http/protobuff
run: |
export PATH="$(go env GOPATH)/bin:$PATH"
make openapi-v3
- name: Apply OpenAPI adjustments
working-directory: qubic-http/protobuff
run: |
# Remove the internal-only /health endpoint (upstream marks it
# "for internal use only ... Do not rely on this endpoint").
# --indent 4 matches the generator output so yq doesn't reflow the file.
yq -i --indent 4 'del(.paths."/health")' qubic.openapi.yaml
- name: Copy spec into place
run: cp qubic-http/protobuff/qubic.openapi.yaml static/openapi/qubic-http.openapi.yaml
- name: Check for changes
id: changes
run: |
if git diff --quiet static/openapi/qubic-http.openapi.yaml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT_TOKEN }}
commit-message: "docs: update Live API OpenAPI specification"
title: "docs: update Live API OpenAPI specification"
body: |
This PR updates the Live API OpenAPI specification from [qubic/qubic-http](https://github.com/qubic/qubic-http).
This PR was automatically generated.
branch: docs/update-live-api-spec
delete-branch: true
labels: automated
add-paths: |
static/openapi/qubic-http.openapi.yaml
query-api-update:
if: >
github.event_name == 'repository_dispatch' && github.event.action == 'query-api-update' ||
github.event_name == 'workflow_dispatch' && (github.event.inputs.api == 'query' || github.event.inputs.api == 'both')
runs-on: ubuntu-latest
concurrency:
group: query-api-update
cancel-in-progress: true
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
- name: Checkout archive-query-service
uses: actions/checkout@v4
with:
repository: qubic/archive-query-service
ref: ${{ github.event.client_payload.ref || 'main' }}
path: archive-query-service
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.26.x
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Install protoc-gen-openapi
run: go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
- name: Generate OpenAPI spec
working-directory: archive-query-service/v2
run: |
export PATH="$(go env GOPATH)/bin:$PATH"
make openapi-v3-gen
- name: Apply OpenAPI adjustments
run: |
cd archive-query-service/v2/api/archive-query-service/v2
yq -i --indent 4 'del(.paths."/health")' query_services.openapi.yaml
yq -i --indent 4 '(.tags[] | select(.name == "ArchiveQueryService")).x-scalar-ignore = true' query_services.openapi.yaml
yq -i --indent 4 '(.paths[][].tags) -= ["ArchiveQueryService"]' query_services.openapi.yaml
- name: Copy spec into place
run: cp archive-query-service/v2/api/archive-query-service/v2/query_services.openapi.yaml static/openapi/query-services.openapi.yaml
- name: Check for changes
id: changes
run: |
if git diff --quiet static/openapi/query-services.openapi.yaml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT_TOKEN }}
commit-message: "docs: update Query API OpenAPI specification"
title: "docs: update Query API OpenAPI specification"
body: |
This PR updates the Query API OpenAPI specification from [qubic/archive-query-service](https://github.com/qubic/archive-query-service).
This PR was automatically generated.
branch: docs/update-query-api-spec
delete-branch: true
labels: automated
add-paths: |
static/openapi/query-services.openapi.yaml