-
Notifications
You must be signed in to change notification settings - Fork 41
Swagger json Automation #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughAdds a GitHub Actions workflow to sync Swagger JSON to AMRIT-Docs, adds an H2 runtime dependency and swagger profile properties, disables Changes
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions
participant Runner as Build Runner
participant API as Identity API (dev server)
participant Docs as AMRIT-Docs repo
participant GH as GitHub API
GHA->>Runner: checkout repo, setup Java 17 & Maven cache
Runner->>Runner: mvn package -DskipTests
Runner->>API: start with profile=swagger (H2 in-memory)
loop poll until ready
GHA->>API: GET /v3/api-docs
API-->>GHA: Swagger JSON
end
GHA->>GHA: validate/format JSON with jq -> identity-api.json
GHA->>API: stop server
GHA->>Docs: checkout amrit-docs (token), copy identity-api.json -> docs/swagger/
GHA->>GH: create PR (branch auto/swagger-update-...)
GH-->>GHA: PR created
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/workflows/swagger-json.yml:
- Around line 32-38: The current step saves the PID of the Maven wrapper (the
`mvn` process) to api_pid.txt, but `spring-boot:run` forks a child Java process
so killing that PID won't stop the app; change the run invocation to disable
forking by adding -Dspring-boot.run.fork=false to the `mvn spring-boot:run`
command (or alternatively capture the actual Java PID via `lsof -ti:9090` after
startup) so the saved PID in api_pid.txt corresponds to the Java process and the
later `kill`/`Stop API` step will reliably terminate the application; update the
`nohup mvn spring-boot:run \` invocation and the PID capture logic (api_pid.txt)
accordingly and remove or keep the `fuser` fallback as desired.
- Around line 69-82: Remove the unnecessary initial "sleep 5" and stop
attempting to signal a process group with kill -- -"$PID"; instead, when
api_pid.txt exists read PID and send a graceful termination to that PID (kill
-TERM "$PID"), wait a short interval, then force-kill the PID (kill -9 "$PID")
if still alive; keep the fuser -k 9090/tcp fallback. Update the "Stop API" step
to use PID (not negative PID) for TERM/9 retries and remove the pre-signal sleep
so shutdown begins immediately.
🧹 Nitpick comments (5)
.github/workflows/swagger-json.yml (5)
14-17: Full history checkout is unnecessary for this workflow.
fetch-depth: 0clones the entire Git history, which slows the checkout step. Since the workflow only builds the project and doesn't need history, the default shallow clone (fetch-depth: 1) is sufficient.♻️ Suggested fix
- name: Checkout API repo (full history) uses: actions/checkout@v4 - with: - fetch-depth: 0
29-30:jqis pre-installed onubuntu-latestrunners.This step can be removed to save a few seconds. GitHub-hosted
ubuntu-latestimages already includejq.
84-90:fetch-depth: 0is unnecessary for the docs repo checkout as well.The create-pull-request action only needs the current state to commit changes. A shallow clone suffices.
3-6: Consider adding path filters to avoid unnecessary runs.Currently, every push to
main(including README edits, CI config changes, etc.) triggers a full build + Swagger sync. Adding path filters would reduce unnecessary workflow runs.♻️ Suggested improvement
on: push: branches: [ main ] + paths: + - 'src/**' + - 'pom.xml' workflow_dispatch:
97-109:peter-evans/create-pull-request@v8is a valid, published version (v8.0.0, released Dec 9, 2025), but consider pinning to exact version or commit SHA for enhanced supply-chain security.Using the major version tag
@v8is acceptable and widely used for GitHub Actions, but it remains mutable within the v8.x range. For stronger supply-chain security, consider pinning to@v8.0.0(exact version) or a specific commit SHA instead. This prevents unexpected behavior changes if a future v8.x release introduces breaking changes or vulnerabilities.
|



Summary by CodeRabbit
New Features
Documentation
Chores