-
Notifications
You must be signed in to change notification settings - Fork 413
98 lines (83 loc) · 2.83 KB
/
autogen.yaml
File metadata and controls
98 lines (83 loc) · 2.83 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
name: Autogen
on:
push:
branches:
- main
tags:
- v*
paths:
- "website/static/openapi/**"
pull_request:
types: [ opened, synchronize ]
paths:
- "website/static/openapi/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate the OpenAPI spec
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout (default)
uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
ref: ${{ github.head_ref }}
- name: Set up node
uses: actions/setup-node@v4
- name: Install Redocly CLI
run: npm install -g @redocly/cli@latest
- name: Run linter
run: |
redocly lint --skip-rule=info-license --skip-rule=no-server-example.com --skip-rule=operation-summary \
--skip-rule=operation-4xx-response ./website/static/openapi/openapi.yaml --format=github-actions
generate:
name: Generate the OpenAPI client
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout (default)
uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
ref: ${{ github.head_ref }}
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.26.1'
- name: Install Oapi Codegen and generate client
run: |
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest
make client
- name: Push the generated code
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: "[Autogen] Generated client from OpenAPI spec"
- name: Create a pull request
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[Autogen] Generated client from OpenAPI spec"
title: "[Autogen] OpenAPI client update"
body: "OpenAPI client was (re)generated from the latest OpenAPI spec."
branch: "openapi/client/autogen-${{ github.sha }}"
base: main
labels: openapi-client, autogen