Skip to content

Conversation

@DurgaPrasad-54
Copy link
Contributor

@DurgaPrasad-54 DurgaPrasad-54 commented Feb 11, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fails CI when fetched API JSON is invalid or has no paths; improves shutdown to reliably free stuck processes and ports.
  • Chores

    • Runs builds in non-interactive mode; increases API polling attempts; fetches full repo history; updates PR action version, simplifies branch naming, adds branch deletion, and standardizes commit/PR titles.
  • Documentation

    • Makes automated API documentation updates more consistent and trustworthy.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

 _________________________________________________________________________________________________________________
< Estimate the order of your algorithms. Get a feel for how long things are likely to take before you write code. >
 -----------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

📝 Walkthrough

Walkthrough

CI workflow updates for Swagger JSON generation: Maven runs in batch mode, Swagger fetch now validates JSON and ensures non-empty paths, polling increased, shutdown and port-cleanup hardened, checkout fetches full history, PR action/version/branch/commit-title conventions updated, and created PRs are set to delete the branch.

Changes

Cohort / File(s) Summary
Swagger Generation Workflow
.github/workflows/swagger-json.yml
Maven now runs with -B. Swagger fetch adds jq JSON validation and a non-empty paths check; poll iterations increased (30→40). API shutdown enhanced: graceful process-group stop, force-kill fallback, then fuser to free port 9090. actions/checkout uses fetch-depth: 0. create-pull-request action bumped v6→v8; branch name simplified to auto/swagger-update; commit message and PR title use chore(docs): auto-update Common-API swagger; delete-branch: true added. Minor PR body formatting tweak.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 In the CI burrow I hop and I hum,
Maven in batch, now faster I drum.
JSON is checked, no empty paths stay,
Ports freed, branches pruned away.
Hooray — docs updated, I nibble and run! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the swagger JSON GitHub workflow file with improvements to build, validation, and deployment logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

run: |
mkdir -p amrit-docs/docs/swagger
cp common-api.json amrit-docs/docs/swagger/common-api.json
cp tm-api.json amrit-docs/docs/swagger/tm-api.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DurgaPrasad-54 why does this say tm api in common?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/swagger-json.yml:
- Around line 96-104: The workflow currently generates unique branches per run
via the create-pull-request step (uses: peter-evans/create-pull-request@v8)
using branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt
}}, which causes many stale PRs; change this to a fixed branch name (e.g.,
branch: auto/swagger-update) so the action will update/force-push the same
branch and keep a single PR open, retaining delete-branch: true for cleanup
after merge.
🧹 Nitpick comments (2)
.github/workflows/swagger-json.yml (2)

67-80: Misleading comments and unconditional sleep 5 before the PID check.

Two concerns:

  1. Comment–code mismatch: The "Graceful shutdown" comment (Line 70) annotates the bare sleep 5, while the actual graceful signal (SIGTERM, Line 75) sits under the "Force kill" comment (Line 72). This will confuse future maintainers.

  2. Process-group kill may be a no-op: kill -- -"$PID" treats $PID as a PGID. The $! captured on Line 36 is the Maven wrapper PID, which is not guaranteed to be a process-group leader in the Actions runner shell. If it isn't, both kill calls silently fail and only fuser on Line 80 actually cleans up — so the logic is safe, but the intermediate steps would be dead code.

  3. Minor: The unconditional sleep 5 (Line 71) runs even when api_pid.txt doesn't exist. Move it inside the if block.

Proposed cleanup
       - name: Stop API
         if: always()
         run: |
-          # Graceful shutdown of the process group
-          sleep 5
-          # Force kill the process group if still running
           if [ -f api_pid.txt ]; then
-              PID=$(cat api_pid.txt)
-              kill -TERM -- -"$PID" 2>/dev/null || true
-              sleep 2
-              kill -9 -- -"$PID" 2>/dev/null || true
-            fi
-            # Fallback: kill any remaining java process on port 9090
-            fuser -k 9090/tcp 2>/dev/null || true
+            PID=$(cat api_pid.txt)
+            # Graceful SIGTERM, then wait
+            kill -TERM "$PID" 2>/dev/null || true
+            sleep 5
+            # Force SIGKILL if still running
+            kill -9 "$PID" 2>/dev/null || true
+            sleep 1
+          fi
+          # Fallback: kill anything still on port 9090
+          fuser -k 9090/tcp 2>/dev/null || true

30-36: Consider using setsid to guarantee a new process group for reliable group-kill in the Stop step.

The PID captured by $! on Line 36 may not be a process-group leader (relevant to the kill -- -"$PID" calls in the Stop step). If you want the process-group kill pattern to work reliably, launch with setsid:

-          mvn spring-boot:run \
+          setsid mvn spring-boot:run \
             -Dspring-boot.run.profiles=swagger \
             -Dspring-boot.run.arguments=--server.port=9090 \
             > app.log 2>&1 &

This ensures the Maven process is a session/group leader, making kill -- -"$PID" effective and cleaning up all child processes (including the forked Java process).

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants