Skip to content

Commit cff75cf

Browse files
committed
add daily model generation workflow
1 parent 5620b0b commit cff75cf

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Daily Model Generation
2+
3+
on:
4+
schedule:
5+
# Run at 1 AM UTC every day
6+
- cron: '0 1 * * *'
7+
workflow_dispatch: # Allow manual triggering
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
generate-models:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Java
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: 'corretto'
27+
java-version: '17'
28+
architecture: x64
29+
30+
- name: Cache Maven dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.m2/repository
34+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: |
36+
${{ runner.os }}-maven-
37+
38+
- name: Generate models from OpenAPI spec
39+
run: mvn -Pgenerate-models
40+
41+
- name: Check for changes
42+
id: git-check
43+
run: |
44+
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
45+
46+
- name: Create Pull Request
47+
if: steps.git-check.outputs.changes == 'true'
48+
uses: peter-evans/create-pull-request@v6
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
commit-message: 'chore: update generated models from OpenAPI spec'
52+
branch: automated/model-generation-${{ github.run_number }}
53+
delete-branch: true
54+
title: 'chore: Update generated models from OpenAPI spec'
55+
body: |
56+
## Automated Model Generation
57+
58+
This PR contains automatically generated updates to the SDK models based on the latest OpenAPI specification from `https://api.prime.coinbase.com/v1/openapi.yaml`.
59+
60+
### What changed?
61+
- Models generated/updated via `mvn -Pgenerate-models`
62+
- Changes reflect updates to the Prime API specification
63+
64+
### How to review
65+
1. Verify that generated files follow SDK conventions
66+
2. Check that new models have proper Builder patterns and license headers
67+
3. Ensure enums are properly generated
68+
4. Run tests to verify compatibility: `mvn clean install`
69+
70+
### Generated by
71+
Workflow: `${{ github.workflow }}`
72+
Run: `${{ github.run_id }}`
73+
Triggered: `${{ github.event_name }}`
74+
labels: |
75+
automated
76+
model-generation
77+
assignees: ${{ github.repository_owner }}
78+
79+
- name: No changes detected
80+
if: steps.git-check.outputs.changes != 'true'
81+
run: echo "No model changes detected. Skipping PR creation."

0 commit comments

Comments
 (0)