-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (46 loc) · 1.63 KB
/
generate-openapi.yml
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
name: Generate SDK and Open PR
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 0' # Runs every Sunday at 12:00 UTC
jobs:
generate-sdk:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run SDK generation script
run: generate_openapi.sh
- name: Check for changes
id: check_changes
run: |
git diff --exit-code || echo "changes"
- name: Commit changes
if: steps.check_changes.outputs.changes == 'changes'
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git checkout -b feat/sdk-update-$(date +'%Y%m%d')
git add .
git commit -m "Update SDK from OpenAPI specs"
- name: Push changes to a new branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin feat/sdk-update-$(date +'%Y%m%d')
- name: Create a pull request
id: create_pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: sdk-update-$(date +'%Y%m%d')
title: "OpenAPI SDK Update"
body: "This PR updates the SDK based on the latest OpenAPI specifications."
- name: Output PR URL
if: steps.create_pr.outputs.pull-request-url != ''
run: |
echo "Pull Request URL: ${{ steps.create_pr.outputs.pull-request-url }}"