diff --git a/README.md b/README.md index 9617bfa1..4279bf69 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ [![GitHub license](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Codium-ai/pr-agent/blob/main/LICENSE) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=purple)](https://discord.com/channels/1057273017547378788/1126104260430528613) -
+
-CodiumAI `pr-agent` is an open-source tool aiming to help developers review PRs faster and more efficiently. It automatically analyzes the PR and can provide several types of feedback: +CodiumAI `PR-Agent` is an open-source tool aiming to help developers review PRs faster and more efficiently. It automatically analyzes the PR and can provide several types of feedback: **Auto-Description**: Automatically generating PR description - name, type, summary, and code walkthrough. \ @@ -64,7 +64,7 @@ To set up your own PR-Agent, see the [Quickstart](#Quickstart) section --- ## Overview -`pr-agent` offers extensive pull request functionalities across various git providers: +`PR-Agent` offers extensive pull request functionalities across various git providers: | | | Github | Gitlab | Bitbucket | |-------|---------------------------------------------|--------|--------|-----------| | TOOLS | Review | ✓ | ✓ | ✓ | @@ -128,7 +128,52 @@ Possible questions you can ask include: --- -#### Method 2: Run from source +#### Method 2: Run as a Github Action + +You can use our pre-built Github Action Docker image to run PR-Agent as a Github Action. + +1. Add the following file to your repository under `.github/workflows/pr_agent.yml`: + +```yaml +on: + pull_request: + issue_comment: +jobs: + pr_agent_job: + runs-on: ubuntu-latest + name: Run pr agent on every pull request, respond to user comments + steps: + - name: PR Agent action step + id: pragent + uses: Codium-ai/pr-agent@main + env: + OPENAI_KEY: ${{ secrets.OPENAI_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +2. Add the following secret to your repository under `Settings > Secrets`: + +``` +OPENAI_KEY: +``` + +The GITHUB_TOKEN secret is automatically created by Github. + +3. Merge this change to your main branch. +When you open your next PR, you should see a comment from `github-actions` bot with a review of your PR, and instructions on how to use the rest of the tools. + +4. You may configure PR-Agent by adding environment variables under the env section that corresponds to any configurable property in the [configuration](./CONFIGURATION.md) file. Some examples: +```yaml + env: + # ... previous environment values + OPENAI.ORG: "" + PR_REVIEWER.REQUIRE_TESTS_REVIEW: "false" # Disable tests review + PR_CODE_SUGGESTIONS.NUM_CODE_SUGGESTIONS: 6 # Increase number of code suggestions +``` + +--- + +#### Method 3: Run from source 1. Clone this repository: @@ -160,7 +205,7 @@ python pr_agent/cli.py --pr_url improve --- -#### Method 3: Method 3: Run as a polling server; request reviews by tagging your Github user on a PR +#### Method 4: Run as a polling server; request reviews by tagging your Github user on a PR Follow steps 1-3 of method 2. Run the following command to start the server: @@ -171,7 +216,7 @@ python pr_agent/servers/github_polling.py --- -#### Method 4: Run as a Github App, allowing you to automate the review process on your private or public repositories. +#### Method 5: Run as a Github App, allowing you to automate the review process on your private or public repositories. 1. Create a GitHub App from the [Github Developer Portal](https://docs.github.com/en/developers/apps/creating-a-github-app). diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index c992d236..99b6a3e6 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -1,14 +1,13 @@ -commands_text = "> /review - Ask for a new review after your update the PR\n" \ - "> /describe - Modify the PR title and description based " \ - "on the PR's contents.\n" \ - "> /improve - Suggest improvements to the code in the PR as pull " \ - "request comments ready to commit.\n" \ - "> /ask - Ask a question about the PR.\n" +commands_text = "> /review - Request a review of the latest update to the PR.\n" \ + "> /describe - Modify the PR title and description based on the contents of the PR.\n" \ + "> /improve - Suggest improvements to the code in the PR. " \ + "These will be provided as pull request comments, ready to commit.\n" \ + "> /ask - Pose a question about the PR.\n" def bot_help_text(user: str): return f"> Tag me in a comment '@{user}' and add one of the following commands:\n" + commands_text -actions_help_text = "> Add a comment to to invoke PR-Agent, use one of the following commands:\n" + \ +actions_help_text = "> To invoke the PR-Agent, add a comment using one of the following commands:\n" + \ commands_text diff --git a/requirements.txt b/requirements.txt index 64134909..8695f709 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ uvicorn==0.22.0 python-gitlab==3.15.0 pytest~=7.4.0 aiohttp~=3.8.4 +atlassian-python-api==3.39.0