Skip to content
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

feat: add pr title validation feature #65

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

sujoy-pal144
Copy link
Contributor

@sujoy-pal144 sujoy-pal144 commented May 7, 2024

New Feature-
To validate PR Title
The github workflow will be triggered when the PR is opened, reopened or edited.

PR Validations -

  1. should match the prefix types (like - build, chore, ci, docs, feat, fix, perf, refactor, style, test, sample)
  2. should be under 50 characters

Summary by CodeRabbit

  • New Features

    • Introduced a validation script in Python to validate pull request titles.
    • Enhanced Docker setup instructions for Angular, .NET, and Node.js projects.
  • Documentation

    • Improved clarity and added new commands in Docker setup guides for Angular, .NET, and Node.js environments.

Copy link

coderabbitai bot commented May 7, 2024

Walkthrough

The recent updates bring a GitHub Actions workflow for PR title validation and enhance Docker setups for Angular, .NET, and Node.js projects. These improvements aim to streamline development processes by automating validations and optimizing container configurations.

Changes

File Path Change Summary
.github/workflows/pr_title_validation.yml Added workflow for PR title validation.
docker-setups/angular-docker.md Updated Docker instructions for Angular projects.
docker-setups/dotnet-github.md Modified Docker configurations for .NET projects.
docker-setups/nodejs-github.md Updated Docker volume configuration for Node.js projects.
validate_title.py Introduced a Python function to validate PR titles.

🐇✨
Oh hooray! Oh joy! New changes deploy,
In Docker's embrace, our apps enjoy.
With titles checked, no chaos in sight,
Our code now sails into the night.
Cheers to clean PRs and smoother flights! 🚀🌌
🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

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

Out of diff range and nitpick comments (3)
docker-setups/nodejs-github.md (1)

171-175: Add a description for the COMPOSE_PROJECT_NAME environment variable to clarify its purpose.

docker-setups/angular-docker.md (1)

329-335: Clarify the purpose of the COMPOSE_PROJECT_NAME environment variable in the documentation.

docker-setups/dotnet-github.md (1)

252-256: Add a description for the COMPOSE_PROJECT_NAME environment variable to clarify its purpose.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 91ed3f5 and 76a4b60.
Files selected for processing (5)
  • .github/workflows/pr_title_validation.yml (1 hunks)
  • docker-setups/angular-docker.md (4 hunks)
  • docker-setups/dotnet-github.md (5 hunks)
  • docker-setups/nodejs-github.md (3 hunks)
  • validate_title.py (1 hunks)
Additional comments not posted (4)
validate_title.py (1)

4-22: Ensure the validation script handles edge cases and provides clear error messages.

docker-setups/nodejs-github.md (1)

114-118: Ensure the volume configuration in the Docker Compose file is correctly set up for data persistence.

docker-setups/angular-docker.md (1)

204-206: Ensure the Docker Compose configuration correctly sets the application name and image.

docker-setups/dotnet-github.md (1)

Line range hint 111-134: Ensure the Docker Compose configuration correctly sets up the .NET application and MariaDB service.

uses: actions/checkout@v3

- name: Run validation script
run: python validate_title.py "${{ github.event.pull_request.title }}"
Copy link

@coderabbitai coderabbitai bot May 7, 2024

Choose a reason for hiding this comment

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

Avoid direct interpolation of user input in the run command to prevent potential security risks.

- run: python validate_title.py "${{ github.event.pull_request.title }}"
+ env:
+   PR_TITLE: ${{ github.event.pull_request.title }}
+ run: python validate_title.py "$PR_TITLE"

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.

Suggested change
run: python validate_title.py "${{ github.event.pull_request.title }}"
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: python validate_title.py "$PR_TITLE"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the code as per the suggestion.

Copy link

Choose a reason for hiding this comment

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

@sujoy-pal144, thank you for updating the code as suggested! It's great to see the security enhancement in place. If you need further assistance or have more questions, feel free to ask. Happy coding! 🚀


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 76a4b60 and fb5a811.
Files selected for processing (1)
  • .github/workflows/pr_title_validation.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pr_title_validation.yml

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

Successfully merging this pull request may close these issues.

2 participants