From 9dd1995464e8b90aa24de4f2bcf251aa9541def1 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Mon, 14 Oct 2024 10:25:51 +0300 Subject: [PATCH] docs: update installation guides with GitHub enterprise server instructions and formatting improvements --- docs/docs/installation/github.md | 55 +++++++++++++++++++------------ docs/docs/installation/locally.md | 50 ++++++++++++---------------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/docs/docs/installation/github.md b/docs/docs/installation/github.md index 653b0844..8035d6db 100644 --- a/docs/docs/installation/github.md +++ b/docs/docs/installation/github.md @@ -27,27 +27,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` - -if you want to pin your action to a specific release (v0.23 for example) for stability reasons, use: -```yaml -... - steps: - - name: PR Agent action step - id: pragent - uses: docker://codiumai/pr-agent:0.23-github_action -... -``` - -For enhanced security, you can also specify the Docker image by its [digest](https://hub.docker.com/repository/docker/codiumai/pr-agent/tags): -```yaml -... - steps: - - name: PR Agent action step - id: pragent - uses: docker://codiumai/pr-agent@sha256:14165e525678ace7d9b51cda8652c2d74abb4e1d76b57c4a6ccaeba84663cc64 -... -``` - 2) Add the following secret to your repository under `Settings > Secrets and variables > Actions > New repository secret > Add secret`: ``` @@ -70,6 +49,40 @@ When you open your next PR, you should see a comment from `github-actions` bot w ``` See detailed usage instructions in the [USAGE GUIDE](https://qodo-merge-docs.qodo.ai/usage-guide/automations_and_usage/#github-action) +### Using a specific release +!!! tip "" + if you want to pin your action to a specific release (v0.23 for example) for stability reasons, use: + ```yaml + ... + steps: + - name: PR Agent action step + id: pragent + uses: docker://codiumai/pr-agent:0.23-github_action + ... + ``` + + For enhanced security, you can also specify the Docker image by its [digest](https://hub.docker.com/repository/docker/codiumai/pr-agent/tags): + ```yaml + ... + steps: + - name: PR Agent action step + id: pragent + uses: docker://codiumai/pr-agent@sha256:14165e525678ace7d9b51cda8652c2d74abb4e1d76b57c4a6ccaeba84663cc64 + ... + ``` + +### Action for GitHub enterprise server +!!! tip "" + To use the action with a GitHub enterprise server, add an environment variable `GITHUB.BASE_URL` with the API URL of your GitHub server. + + For example, if your GitHub server is at `https://github.mycompany.com`, add the following to your workflow file: + ```yaml + env: + # ... previous environment values + GITHUB.BASE_URL: "https://github.mycompany.com/api/v3" + ``` + + --- ## Run as a GitHub App diff --git a/docs/docs/installation/locally.md b/docs/docs/installation/locally.md index 123a6c03..fad9d789 100644 --- a/docs/docs/installation/locally.md +++ b/docs/docs/installation/locally.md @@ -16,8 +16,8 @@ from pr_agent.config_loader import get_settings def main(): # Fill in the following values - provider = "github" # GitHub provider - user_token = "..." # GitHub user token + provider = "github" # github/gitlab/bitbucket/azure_devops + user_token = "..." # user token openai_key = "..." # OpenAI key pr_url = "..." # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809' command = "/review" # Command to run (e.g. '/review', '/describe', '/ask="What is the purpose of this PR?"', ...) @@ -42,42 +42,34 @@ A list of the relevant tools can be found in the [tools guide](../tools/ask.md). To invoke a tool (for example `review`), you can run directly from the Docker image. Here's how: - For GitHub: -``` -docker run --rm -it -e OPENAI.KEY= -e GITHUB.USER_TOKEN= codiumai/pr-agent:latest --pr_url review -``` + ``` + docker run --rm -it -e OPENAI.KEY= -e GITHUB.USER_TOKEN= codiumai/pr-agent:latest --pr_url review + ``` + If you are using GitHub enterprise server, you need to specify the custom url as variable. + For example, if your GitHub server is at `https://github.mycompany.com`, add the following to the command: + ``` + -e GITHUB.BASE_URL=https://github.mycompany.com/api/v3 + ``` - For GitLab: -``` -docker run --rm -it -e OPENAI.KEY= -e CONFIG.GIT_PROVIDER=gitlab -e GITLAB.PERSONAL_ACCESS_TOKEN= codiumai/pr-agent:latest --pr_url review -``` + ``` + docker run --rm -it -e OPENAI.KEY= -e CONFIG.GIT_PROVIDER=gitlab -e GITLAB.PERSONAL_ACCESS_TOKEN= codiumai/pr-agent:latest --pr_url review + ``` -Note: If you have a dedicated GitLab instance, you need to specify the custom url as variable: -``` -docker run --rm -it -e OPENAI.KEY= -e CONFIG.GIT_PROVIDER=gitlab -e GITLAB.PERSONAL_ACCESS_TOKEN= -e GITLAB.URL= codiumai/pr-agent:latest --pr_url review -``` + If you have a dedicated GitLab instance, you need to specify the custom url as variable: + ``` + -e GITLAB.URL= + ``` - For BitBucket: -``` -docker run --rm -it -e CONFIG.GIT_PROVIDER=bitbucket -e OPENAI.KEY=$OPENAI_API_KEY -e BITBUCKET.BEARER_TOKEN=$BITBUCKET_BEARER_TOKEN codiumai/pr-agent:latest --pr_url= review -``` + ``` + docker run --rm -it -e CONFIG.GIT_PROVIDER=bitbucket -e OPENAI.KEY=$OPENAI_API_KEY -e BITBUCKET.BEARER_TOKEN=$BITBUCKET_BEARER_TOKEN codiumai/pr-agent:latest --pr_url= review + ``` For other git providers, update CONFIG.GIT_PROVIDER accordingly, and check the `pr_agent/settings/.secrets_template.toml` file for the environment variables expected names and values. --- - -If you want to ensure you're running a specific version of the Docker image, consider using the image's digest: -```bash -docker run --rm -it -e OPENAI.KEY= -e GITHUB.USER_TOKEN= codiumai/pr-agent@sha256:71b5ee15df59c745d352d84752d01561ba64b6d51327f97d46152f0c58a5f678 --pr_url review -``` - -Or you can run a [specific released versions](https://github.com/Codium-ai/pr-agent/blob/main/RELEASE_NOTES.md) of pr-agent, for example: -``` -codiumai/pr-agent@v0.9 -``` - ---- - ## Run from source 1. Clone this repository: @@ -115,7 +107,7 @@ python3 -m pr_agent.cli --issue_url similar_issue ... ``` -[Optional] Add the pr_agent folder to your PYTHONPATH +[Optional] Add the pr_agent folder to your PYTHONPATH ``` export PYTHONPATH=$PYTHONPATH: ``` \ No newline at end of file