Skip to content

query-api-update

query-api-update #26

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: 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