Skip to content

chore: enable dependabot and dependency-submission workflow#322

Closed
vinodbhorge wants to merge 3 commits into
Sunbird-Knowlg:masterfrom
vinodbhorge:feature/dependabot-enable-20260427151618
Closed

chore: enable dependabot and dependency-submission workflow#322
vinodbhorge wants to merge 3 commits into
Sunbird-Knowlg:masterfrom
vinodbhorge:feature/dependabot-enable-20260427151618

Conversation

@vinodbhorge

@vinodbhorge vinodbhorge commented Apr 27, 2026

Copy link
Copy Markdown
  • Add .github/dependabot.yml for npm ecosystem (src/ directory)
  • Add .github/workflows/dependency-submission.yml
    • Plugin: actions/dependency-review-action@v4
    • Captures full transitive dependency set via npm ci
    • Triggers: push and pull_request on master

Generated by Dependabot Sub-Agent

Summary by CodeRabbit

  • Chores
    • Enhanced dependency management with automated scanning and monitoring workflows to improve project maintenance.

- Add .github/dependabot.yml for npm ecosystem (src/ directory)
- Add .github/workflows/dependency-submission.yml
  - Plugin: actions/dependency-review-action@v4
  - Captures full transitive dependency set via npm ci
  - Triggers: push and pull_request on master

Generated by Dependabot Sub-Agent
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@vinodbhorge has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 57 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aaba4490-4a89-4527-9f2a-cc0dc1453a27

📥 Commits

Reviewing files that changed from the base of the PR and between fc83a34 and da80bb1.

📒 Files selected for processing (1)
  • .github/workflows/dependency-submission.yml
📝 Walkthrough

Walkthrough

Adds GitHub configuration for automated dependency management: a Dependabot configuration for npm package updates in the /src directory with weekly scanning, and a GitHub Actions workflow for dependency submission that installs dependencies and runs dependency review on master branch events.

Changes

Cohort / File(s) Summary
Dependency Management Configuration
.github/dependabot.yml, .github/workflows/dependency-submission.yml
Introduces automated dependency scanning and submission. Dependabot monitors npm packages in /src with weekly intervals, limits concurrent PRs to 10, and labels updates. Workflow runs on master push/PR events, sets up Node.js 20, installs dependencies via npm ci, and submits dependency information using the review action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hoppity-hop, dependencies flow,
Dependabot's updates will help your code grow,
Weekly checks keep your packages so fine,
With GitHub Actions keeping time in line!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main changes: enabling Dependabot configuration and dependency-submission workflow for npm package scanning and dependency tracking.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/dependency-submission.yml:
- Around line 9-10: The workflow currently grants overly broad repository write
access by setting permissions: contents: write for
actions/dependency-review-action@v4; change the permissions to the
least-privilege set by replacing contents: write with contents: read, and if you
want the action to post PR summary comments add pull-requests: write alongside
contents: read; ensure no other write-level permissions remain in the
permissions block so the action only has the minimal required scopes.
- Around line 3-7: Remove the unsupported "push" trigger from the workflow's on:
block so the job only runs for supported events (e.g., pull_request);
specifically edit the on: section that currently includes push: branches:
["master"] and delete that push: entry, leaving pull_request: branches:
["master"] (or add pull_request_target/merge_group if you need those events) to
ensure actions/dependency-review-action runs only on supported triggers.
- Around line 18-25: Update the dependency-submission GitHub Actions step that
uses actions/setup-node@v4 to set node-version to '22.17.1' (matching the
Dockerfile's node:22.17.1-bookworm) so dependencies are resolved against the
same Node major/minor as production; keep the working-directory: src and npm ci
step unchanged. Optionally add or reference a single source-of-truth for Node
(e.g., .nvmrc or package.json engines) to prevent future drift.
- Around line 27-30: The workflow step currently uses
actions/dependency-review-action@v4 with an invalid input name and a misleading
purpose; change the input key from token to repo-token if you intend to keep
using dependency-review-action (or just remove the with: block since repo-token
defaults to ${{ github.token }}), and either rename the step to reflect “Review
npm Dependencies” or replace the action with a proper submission action (for
example actions/component-detection-dependency-submission-action or an action
built with `@github/dependency-submission-toolkit`) when you truly want to submit
a dependency snapshot; alternatively, include two distinct steps: one using
dependency-review-action@v4 for review (use repo-token) and another using a
Dependency Submission action for submission.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8393942a-024f-4530-ab69-94bed12c90dd

📥 Commits

Reviewing files that changed from the base of the PR and between 95d0c60 and fc83a34.

📒 Files selected for processing (2)
  • .github/dependabot.yml
  • .github/workflows/dependency-submission.yml

Comment on lines +3 to +7
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Does actions/dependency-review-action v4 support push events, or only pull_request / pull_request_target / merge_group?

💡 Result:

actions/dependency-review-action v4 does not natively support push events. It is designed primarily for pull_request and pull_request_target events, where it automatically determines base-ref and head-ref. For other events like push or merge_group, users must manually provide base-ref and head-ref inputs, as indicated in the official documentation and action.yml: "Has a default value when the workflow event is pull_request or pull_request_target. Must be provided otherwise." Examples in the repo README and GitHub Docs always use on: [pull_request]. GitHub issues (#677, #826, #30, #456) discuss workarounds for push and merge_group by setting these refs manually, confirming no built-in push support. Thus, it supports pull_request / pull_request_target / merge_group only with manual configuration for the latter, but not push without extra setup.

Citations:


Remove the push trigger — actions/dependency-review-action does not support push events and the workflow will fail on every push to master.

The action is designed for pull_request, pull_request_target, and merge_group triggers, where it automatically determines the base and head refs. On a push event there is no base ref to compare against, and the action will exit with an error.

🔧 Proposed fix
 on:
-  push:
-    branches: ["master"]
   pull_request:
     branches: ["master"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
on:
pull_request:
branches: ["master"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/dependency-submission.yml around lines 3 - 7, Remove the
unsupported "push" trigger from the workflow's on: block so the job only runs
for supported events (e.g., pull_request); specifically edit the on: section
that currently includes push: branches: ["master"] and delete that push: entry,
leaving pull_request: branches: ["master"] (or add
pull_request_target/merge_group if you need those events) to ensure
actions/dependency-review-action runs only on supported triggers.

Comment thread .github/workflows/dependency-submission.yml
Comment on lines +18 to +25
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies (ci install for full lock resolution)
working-directory: src
run: npm ci

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify lockfile presence and any engines field.
fd -H -t f 'package-lock.json' src 2>/dev/null
rg -nP '"engines"\s*:' src/package.json || echo "no engines field"

Repository: Sunbird-Knowlg/knowledge-mw-service

Length of output: 118


🏁 Script executed:

fd -H -t f 'Dockerfile' . 2>/dev/null

Repository: Sunbird-Knowlg/knowledge-mw-service

Length of output: 92


🏁 Script executed:

fd -H -t f '.nvmrc' . 2>/dev/null

Repository: Sunbird-Knowlg/knowledge-mw-service

Length of output: 61


🏁 Script executed:

cat src/package.json | head -50

Repository: Sunbird-Knowlg/knowledge-mw-service

Length of output: 2235


🏁 Script executed:

cat Dockerfile

Repository: Sunbird-Knowlg/knowledge-mw-service

Length of output: 407


Align Node.js version in dependency-submission workflow with production (22.17.1).

The Dockerfile pins node:22.17.1-bookworm for production, but this workflow installs Node 20. Resolving dependencies on a different major version can mask engine-incompatible packages or peer-dependency issues.

The src/package-lock.json file is present and committed, so npm ci will work as expected. However, without a single source of truth (.nvmrc or engines field), version drift is likely. Align the workflow to Node 22.17.1 to match production.

♻️ Suggested change
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
-          node-version: '20'
+          node-version: '22.17.1'
+          cache: 'npm'
+          cache-dependency-path: src/package-lock.json
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/dependency-submission.yml around lines 18 - 25, Update the
dependency-submission GitHub Actions step that uses actions/setup-node@v4 to set
node-version to '22.17.1' (matching the Dockerfile's node:22.17.1-bookworm) so
dependencies are resolved against the same Node major/minor as production; keep
the working-directory: src and npm ci step unchanged. Optionally add or
reference a single source-of-truth for Node (e.g., .nvmrc or package.json
engines) to prevent future drift.

Comment thread .github/workflows/dependency-submission.yml Outdated
vinodbhorge and others added 2 commits April 27, 2026 16:18
- Checkout submodules recursively so src/libs is populated before
  npm ci runs its preinstall script
- Add npm sbom generation step; spdx-dependency-submission-action
  requires a pre-generated SPDX file, it does not scan on its own
- Replace dependency-review-action (PR security gate, wrong tool)
  with spdx-dependency-submission-action for actual graph submission
- Drop invalid token input not accepted by the submission action

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
spdx-json is not a valid value; npm sbom only accepts cyclonedx or spdx.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

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.

1 participant