Skip to content

Add License Conformity Check #417

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

Merged
merged 1 commit into from
Dec 1, 2024
Merged

Conversation

uvulpos
Copy link
Owner

@uvulpos uvulpos commented Dec 1, 2024

Summary by CodeRabbit

  • New Features

    • Introduced an automated license checking workflow for both backend and frontend components.
    • Added new license check targets in the Makefile for backend and frontend services.
  • Bug Fixes

    • Enhanced error handling for license checks in both services.
  • Documentation

    • Updated documentation to reflect new license checking capabilities.

Copy link

coderabbitai bot commented Dec 1, 2024

Walkthrough

A new GitHub Actions workflow named license-checker.yaml has been added to automate license checks for a Golang backend and an NPM frontend. This workflow triggers on pull requests and is scheduled to run daily. Additionally, the Makefile has been updated with new variables for allowed licenses and ignore lists, along with two new targets for executing license checks for both backend and frontend services.

Changes

File Change Summary
.github/workflows/license-checker.yaml Introduced a new GitHub Actions workflow for automated license checking for backend and frontend.
Makefile Added variables for allowed licenses and ignore lists; introduced targets for backend and frontend license checks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Golang Backend
    participant NPM Frontend

    User->>GitHub Actions: Trigger Pull Request
    GitHub Actions->>Golang Backend: Run license-check-be
    Golang Backend->>GitHub Actions: Return license check result
    GitHub Actions->>NPM Frontend: Run license-check-fe
    NPM Frontend->>GitHub Actions: Return license check result
    GitHub Actions->>User: Provide license check results
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@uvulpos
Copy link
Owner Author

uvulpos commented Dec 1, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Dec 1, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

sonarqubecloud bot commented Dec 1, 2024

Copy link

@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

🧹 Outside diff range and nitpick comments (2)
Makefile (2)

1-3: Would it make sense to align the allowed licenses between frontend and backend?

Have you considered:

  1. Why is UNLICENSED allowed for frontend but not for backend?
  2. Could we document why different separators are needed?
  3. Should MPL-2.0 be added to frontend licenses as well?

35-43: Would you like to enhance the error reporting?

Could we add informative error messages when the license checks fail? Perhaps something like:

 license-check-be: ## runs golang license check
-	@(cd services/backend ; go-licenses check ./... --allowed_licenses=$(ALLOWED_LICENSES_COMMA) --ignore=$(IGNORE) --one_output); \
-	STATUS=$$?; \
-	exit $$STATUS
+	@(cd services/backend ; go-licenses check ./... --allowed_licenses=$(ALLOWED_LICENSES_COMMA) --ignore=$(IGNORE) --one_output) || \
+	(echo "\033[31mBackend license check failed! Please ensure all dependencies use approved licenses.\033[0m" && exit 1)

 license-check-fe: ## runs npm license check
-	@(cd services/frontend ; license-checker --onlyAllow=$(ALLOWED_LICENSES_SEMICOLON)); \
-	STATUS=$$?; \
-	exit $$STATUS
+	@(cd services/frontend ; license-checker --onlyAllow=$(ALLOWED_LICENSES_SEMICOLON)) || \
+	(echo "\033[31mFrontend license check failed! Please ensure all dependencies use approved licenses.\033[0m" && exit 1)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e490b59 and d103b67.

📒 Files selected for processing (2)
  • .github/workflows/license-checker.yaml (1 hunks)
  • Makefile (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/license-checker.yaml

18-18: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


35-35: the runner of "actions/setup-node@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (3)
.github/workflows/license-checker.yaml (3)

3-9: Would you agree that the workflow triggers are well configured?

The combination of PR events, manual dispatch, and daily schedule at 3 AM UTC provides good coverage for license checking.


20-20: ⚠️ Potential issue

Have you verified the Go version specification?

The specified version 1.23.3 appears to be invalid. Would it be better to use the latest stable version (e.g., 1.21.5)?


35-38: ⚠️ Potential issue

Would you consider updating both the Node.js version and action version?

A few suggestions:

  1. Could we update actions/setup-node to v4 (latest)?
  2. Should we use an LTS Node.js version (e.g., 20.x) instead of 23.3.0?
🧰 Tools
🪛 actionlint (1.7.4)

35-35: the runner of "actions/setup-node@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +18 to +19
uses: actions/setup-go@v4
with:
Copy link

@coderabbitai coderabbitai bot Dec 1, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Would you consider upgrading the setup-go action to v5?

The latest version v5.1.0 is available, which could provide newer features and security improvements. Would you like to update from v4?

🔗 Analysis chain

Should we verify the latest setup-go action version?

Would you like to check if there's a newer version available than v4?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest setup-go action version
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/actions/setup-go/releases/latest | \
  jq -r '.tag_name'

Length of output: 113

🧰 Tools
🪛 actionlint (1.7.4)

18-18: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Copy link
Owner Author

Choose a reason for hiding this comment

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

sounds good, but I'll make a new pr for this

Copy link

Choose a reason for hiding this comment

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

@uvulpos, would you like me to open a GitHub issue to track this upgrade? 🐰🎉

@uvulpos uvulpos merged commit 8c5105b into main Dec 1, 2024
4 checks passed
@uvulpos uvulpos deleted the feat/create-license-conformity-check branch December 1, 2024 21:52
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