From 382f1b4c55ae6f3a0d9416929e0b333b998355f8 Mon Sep 17 00:00:00 2001 From: Bogdan Stanga Date: Sun, 24 Nov 2024 17:16:24 +0200 Subject: [PATCH] add contribution.md --- .env.example | 25 ++++++++++++++++ CONTRIBUTING.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .env.example create mode 100644 CONTRIBUTING.md diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3520cb5 --- /dev/null +++ b/.env.example @@ -0,0 +1,25 @@ +# Copy this file to .env and set the variables +# The variables are only used when running locally + +# REQUIRED: Set this as your Github personal access token +GITHUB_TOKEN= + +# REQUIRED: LLM API +LLM_API_KEY= # API key from your LLM provider (ie Anthropic, Google, OpenAI) +LLM_MODEL= # Model name from your LLM provider (ie claude-3-5-sonnet-20241022, gemini-1.5-flash-latest, gpt-4o-mini) + +# Simulate a Pull Request open event +GITHUB_ACTION=ai-reviewer +GITHUB_EVENT_NAME=pull_request +GITHUB_EVENT_ACTION=created +GITHUB_REPOSITORY=presubmit/ai-reviewer # update with your fork +GITHUB_PULL_REQUEST=1 # update with your pull request number +GITHUB_COMMENT_ID=1111111 # update with your comment id + +# Simulate a Pull Request review comment event +# GITHUB_ACTION=ai-reviewer +# GITHUB_EVENT_NAME=pull_request_review_comment +# GITHUB_EVENT_ACTION=created +# GITHUB_REPOSITORY=presubmit/ai-reviewer # update with your fork +# GITHUB_PULL_REQUEST=1 # update with your pull request number +# GITHUB_COMMENT_ID=1111111 # update with your comment id \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bd6fd66 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,76 @@ +# Contributing to AI PR Reviewer + +Thank you for your interest in contributing to AI PR Reviewer! This document provides guidelines and instructions for contributing to the project. + +## Getting Started + +1. Fork the repository +2. Clone your fork locally +3. Install dependencies with `pnpm install` +4. Create a new branch for your feature/fix: `git checkout -b feature-name` + +## Development Setup + +### Prerequisites + +- Node.js (LTS version recommended) + Typescript +- [Github personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) +- LLM API key from OpenAI, Anthropic or GoogleAI +- (recommended) pnpm package manager + +## Development Workflow + +1. Make your changes in a feature branch +2. Commit your changes using conventional commits: + - `feat: add new feature` + - `fix: resolve bug` + - `docs: update documentation` + - `test: add tests` + - `refactor: improve code structure` +3. Open Pull Request against main repo + +## Testing + +1. Copy the `.env.example` file to `.env`: + + ```bash + cp .env.example .env + ``` + +2. Configure your environment variables in `.env`: + + ```env + # Required: Choose your AI provider + AI_PROVIDER=anthropic # or openai + + # Required: Set your API key and model based on the chosen provider + LLM_API_KEY=... + LLM_MODEL=... + + # Required: Github personal access token + GITHUB_TOKEN=... + ``` + + And uncomment one of the events that you want to test: `pull_request` or `pull_request_review_comment` + +3. Run `pnpm dev` to test the updated reviewer in the Pull Request specied in .env + +## Pull Request Process + +1. Update the README.md with details of significant changes if applicable +2. Ensure your PR description clearly describes the problem and solution +3. Link any related issues using GitHub keywords (e.g., "Fixes #123") +4. Make sure all checks pass on your PR +5. Request review from maintainers + +## Questions or Need Help? + +- Open an issue for questions +- Join our community discussions +- Reach out on [X/Twitter](https://x.com/bdstanga) + +## License + +By contributing to AI PR Reviewer, you agree that your contributions will be licensed under the same license as the project. + +Thank you for contributing to make AI PR Reviewer better! 🚀