Generate API Client #341
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate API Client | |
on: | |
workflow_dispatch: | |
jobs: | |
gen-api: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_CQ_BOT }} | |
- name: Get Specs File | |
run: | | |
curl -H "Authorization: token ${{ secrets.GH_CQ_BOT }}" https://raw.githubusercontent.com/cloudquery/cloud/main/internal/servergen/spec.json -o spec.json | |
- name: Format Specs File | |
run: | | |
docker run --rm -v $(pwd):/local openapitools/openapi-generator-cli:v7.5.0 generate -i /local/spec.json -g openapi --skip-validate-spec -o /local/.generated | |
cp .generated/openapi.json spec.json | |
sudo rm -rf .generated | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Regenerate client | |
run: | | |
go generate ./... | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
# required so the PR triggers workflow runs | |
token: ${{ secrets.GH_CQ_BOT }} | |
branch: fix/gen-cloudquery-api | |
base: main | |
title: 'fix: Generate CloudQuery Go API Client from `spec.json`' | |
commit-message: 'fix: Generate CloudQuery Go API Client from `spec.json`' | |
body: This PR was created by a scheduled workflow to generate the CloudQuery Go API Client from `spec.json` | |
author: cq-bot <cq-bot@users.noreply.github.com> | |
labels: automerge |