Skip to content

Commit 98c9403

Browse files
committed
First commit
1 parent 18c8905 commit 98c9403

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

.github/workflows/gen-client.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Generate API Client
2+
on:
3+
schedule:
4+
- cron: '0 8 * * *'
5+
workflow_dispatch:
6+
7+
jobs:
8+
gen-api:
9+
timeout-minutes: 30
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
token: ${{ secrets.GH_CQ_BOT }}
16+
17+
- name: Get Specs File
18+
run: |
19+
curl -H "Authorization: token ${{ secrets.GH_CQ_BOT }}" https://raw.githubusercontent.com/cloudquery/cloud/main/internal/servergen/spec.json -o spec.json
20+
21+
- name: Set up Go 1.x
22+
uses: actions/setup-go@v3
23+
with:
24+
go-version-file: go.mod
25+
26+
- name: Regenerate client
27+
run: |
28+
go generate ./...
29+
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v5
32+
with:
33+
# required so the PR triggers workflow runs
34+
token: ${{ secrets.GH_CQ_BOT }}
35+
branch: fix/gen-cloudquery-api
36+
base: main
37+
title: 'fix: Generate CloudQuery Go API Client from `spec.json`'
38+
commit-message: 'fix: Generate CloudQuery Go API Client from `spec.json`'
39+
body: This PR was created by a scheduled workflow to generate the CloudQuery Go API Client from `spec.json`
40+
author: cq-bot <cq-bot@users.noreply.github.com>
41+
labels: automerge

client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.13.3 --config=./models.yaml ./spec.json
2+
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.13.3 --config=./client.yaml ./spec.json
3+
package cloudquery_api

client.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package: cloudquery_api
2+
generate:
3+
client: true
4+
output: client.gen.go

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/cloudquery/cloudquery-api-go
2+
3+
go 1.21.0

models.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package: cloudquery_api
2+
generate:
3+
models: true
4+
output: models.gen.go

0 commit comments

Comments
 (0)