-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 1.92 KB
/
regenerate.yml
File metadata and controls
65 lines (55 loc) · 1.92 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
name: Regenerate Client
on:
workflow_dispatch:
jobs:
regenerate:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: 3060111
private-key: ${{ secrets.HOTDATA_AUTOMATION_PRIVATE_KEY }}
owner: hotdata-dev
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Fetch merged OpenAPI spec
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
curl -sS -f -L \
-H "Accept: application/vnd.github.v3.raw" \
-H "Authorization: Bearer $GH_TOKEN" \
https://api.github.com/repos/hotdata-dev/www.hotdata.dev/contents/api/openapi.yaml \
-o openapi.yaml
- name: Clean existing source
run: rm -rf src/
- name: Generate client
run: |
npx @openapitools/openapi-generator-cli generate \
-i openapi.yaml \
-g python \
-o . \
--additional-properties=packageName=hotdata,projectName=hotdata \
--skip-validate-spec
- name: Clean up generated artifacts
run: |
rm -f openapi.yaml
rm -f .github/workflows/python.yml
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Verify generated client imports
run: |
pip install -r requirements.txt
python -c "import hotdata"
- name: Create PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.app-token.outputs.token }}
title: "chore: regenerate client from updated OpenAPI spec"
branch: openapi-update-${{ github.run_id }}
commit-message: "chore: regenerate client from OpenAPI spec"
body: "Auto-generated from updated HotData OpenAPI spec."