File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed
Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Generate
2+
3+ on :
4+ repository_dispatch :
5+ types : [spec-updated]
6+ workflow_dispatch :
7+ schedule :
8+ - cron : ' 0 2 * * *' # Daily check at 2 AM
9+
10+ jobs :
11+ generate :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout wrapper repo
15+ uses : actions/checkout@v3
16+ with :
17+ token : ${{ secrets.GITHUB_TOKEN }}
18+
19+ - name : Download OpenAPI spec
20+ run : |
21+ curl -o spec.yaml https://raw.githubusercontent.com/BuiltByBit/api-openapi-spec/main/spec.yaml
22+
23+ - name : Setup Java
24+ uses : actions/setup-java@v3
25+ with :
26+ distribution : ' temurin'
27+ java-version : ' 11'
28+
29+ - name : Download OpenAPI Generator
30+ run : |
31+ wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -O openapi-generator-cli.jar
32+
33+ - name : Generate Java wrapper
34+ run : |
35+ java -jar openapi-generator-cli.jar generate \
36+ -i spec.yaml \
37+ -g java \
38+ -o ./ \
39+ --skip-validate-spec \
40+ --git-repo-id api-wrapper-codegen-java \
41+ --git-user-id BuiltByBit \
42+ --package-name builtbybit/api-wrapper-codegen-java
43+
44+ - name : Check for changes
45+ id : changes
46+ run : |
47+ if git diff --quiet; then
48+ echo "has-changes=false" >> $GITHUB_OUTPUT
49+ else
50+ echo "has-changes=true" >> $GITHUB_OUTPUT
51+ fi
52+
53+ - name : Commit and push changes
54+ run : |
55+ git config --local user.email "action@github.com"
56+ git config --local user.name "GitHub Action"
57+ git add .
58+ git reset .gitignore
59+ git reset -- $(git ls-files --ignored --exclude-standard) || true
60+ git commit -m "Auto-generate wrapper from updated spec" || exit 0
61+ git push # Uses GITHUB_TOKEN automatically
Original file line number Diff line number Diff line change 1+ # OpenAPI Generator
2+ openapi-generator-cli * .jar
3+ spec.yaml
4+
5+ # Generated build artifacts
6+ .openapi-generator /
You can’t perform that action at this time.
0 commit comments