Skip to content

Commit dcef4c2

Browse files
Create README.md for bito action
1 parent 1fec307 commit dcef4c2

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

bito-action-script/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Bito Action
2+
3+
This document provides a step-by-step guide for setting up and running the Bito Action Script. The Bito Action Script allows you to configure and run automated code reviews using the Bito Code Review Agent (CRA). It enables you to seamlessly integrate the CRA into your Continuous Integration/Continuous Deployment (CI/CD) pipeline. Follow the instructions below to configure and execute the script successfully.
4+
5+
## Steps for Setup
6+
7+
### 1. Login to Bito
8+
9+
- Navigate to the Bito platform: [Bito Login](https://alpha.bito.ai/auth/login).
10+
- Use your credentials to log in to your account.
11+
12+
### 2. Create a New Agent Configuration Instance
13+
14+
- After logging in, go to **Configured Agents**.
15+
- Select **Code Review Agent (CRA)**.
16+
- Click on **Create New Instance**.
17+
18+
### 3. Configure the CRA Agent
19+
20+
- During the setup process, you'll need to provide a Git access token to allow the CRA to access your repositories. Please refer to [Bito Documentation](https://docs.bito.ai/) to create a Git access token.
21+
- After a successful configuration, you'll receive a unique **Agent Instance URL** and **Agent Instance Secret**. These credentials are essential for configuring the Bito Action Script.
22+
23+
### 4. Download Bito Action Script
24+
25+
- Download the Bito Action Script and a sample configuration file from the following repository: [Bito Action Script on GitHub](https://github.com/gitbito/CodeReviewAgent/tree/main/bito-action-script).
26+
27+
### 5. Update the Property File
28+
29+
- Open the `bito_action.properties` file located in the downloaded script folder.
30+
- Update the following properties with the information provided during the CRA configuration:
31+
32+
- agent_instance_url=<your_agent_instance_url>
33+
- agent_instance_secret=<your_agent_instance_secret>
34+
- pr_url=<your_git_repository_url> (Optional if using the runtime URL method)
35+
36+
37+
### 6. Run the Bito Action Script
38+
39+
You can run the Bito Action Script in two different ways, depending on your preference:
40+
41+
#### Option 1: Using the Property File and Runtime Git URL
42+
43+
- Ensure the `bito_action.properties` file is updated with the correct values.
44+
- Run the following command:
45+
46+
```bash
47+
bash ./bito_actions.sh bito_action.properties pr_url=<pr_url>
48+
```
49+
- Replace <pr_url> with the pull request URL you want to review.
50+
51+
52+
#### Option 2: Using Runtime Values
53+
54+
- Provide all necessary values directly in the command line:
55+
56+
```bash
57+
bash ./bito_actions.sh agent_instance_url=<agent_instance_url> agent_instance_secret=<secret> pr_url=<pr_url>
58+
```
59+
- Replace <agent_instance_url>, <secret>, and <pr_url> with your specific values.
60+
61+
### 7. Integrate Bito Action Script into CI/CD Pipeline
62+
63+
- Incorporate the Bito Action Script into your CI/CD pipeline by including the appropriate commands in your build or deployment scripts.
64+
65+
- This integration ensures that code reviews are automatically triggered as part of the pipeline, enhancing your development workflow by enforcing code quality checks on every code change.
66+
67+
## Script Responses
68+
69+
During execution, the script will return various responses based on the success or failure of the process. Below are the possible responses:
70+
71+
### 1. Success
72+
**Response:**
73+
```plaintext
74+
Success:- Job Started with Id : ce82fae8-05da-4389-bddc-86ed583ab053
75+
76+
```
77+
78+
### 2. Invalid Secret
79+
**Response:**
80+
```plaintext
81+
{"status":1,"response":"Secret is not valid","created":"2024-08-09T12:32:23.060340616Z"}
82+
83+
```
84+
85+
### 3. Invalid Instance URL
86+
**Response:**
87+
```plaintext
88+
{"status":1,"response":"webhook is invalid: Please create a new instance","created":"2024-08-09T12:33:07.050869506Z"}
89+
90+
```
91+
92+
### 4. Missing Input Data for Script
93+
**Response:**
94+
```plaintext
95+
Error: pr_url is empty
96+
97+
```
98+
99+
## Example Property File
100+
101+
Below is a sample `bito_action.properties` file:
102+
```plaintext
103+
agent_instance_url=your_agent_instance_url
104+
agent_instance_secret=your_agent_secret
105+
pr_url=
106+
107+
```
108+
109+
## Conclusion
110+
111+
You are now ready to use the Bito Action Script for automated code reviews through CI/CD Pipelines. Ensure all configurations are correct before running the script. If you encounter any issues, consult the [Bito Documentation](https://docs.bito.ai/) or reach out to Bito support for assistance.
112+
113+
114+

0 commit comments

Comments
 (0)