1- ![ github_bg ] ( https://user-images.githubusercontent.com/47952/170700847-bb0cac65-f269-4758-955a-632c48f47290 .png )
1+ ![ Codeball ] ( https://user-images.githubusercontent.com/47952/173048697-d3d39fc3-6238-4fc3-9baf-ccbbb3b4258c .png )
22
3- Test :-)
43
54# CODEBALL &mdash ; AI CODE REVIEW 🔮
65
@@ -30,63 +29,42 @@ jobs:
3029 steps :
3130 - name : Codeball
3231 uses : sturdy-dev/codeball-action@v2
32+ with :
33+ approvePullRequests : " true"
34+ labelPullRequestsWhenApproved : " true"
35+ labelPullRequestsWhenReviewNeeded : " false"
36+ failJobsWhenReviewNeeded : " false"
3337` ` `
3438
35392. 🎉 That's it! Codeball will now run on new Pull Requests, and will approve the PR if it's a good one!
3640
3741## Customizations
3842
39- Codeball Actions are built on multiple smaller building-blocks, that are heavily configurable through GitHub Actions.
43+ Codeball Actions are built on multiple smaller building-blocks, that are heavily configurable through GitHub Actions. Here's a few examples:
44+
45+ _If you're using Codeball in another way, please let us know in an issue!_
4046
4147### Example: "Dry-run" mode, labels all PRs with the Codeball Result
4248
4349<details>
4450 <summary>▶️ codeball-dry-run.yml</summary>
4551
4652` ` ` yaml
53+ name : Codeball
4754on : [pull_request]
4855
49- permissions :
50- contents : read
51- issues : write
52- pull-requests : write
53-
5456jobs :
55- codeball :
57+ codeball_job :
5658 runs-on : ubuntu-latest
5759 name : Codeball
5860 steps :
59-
60- # Start a new Codeball review job
61- # This step is asynchronous and will return a job id
62- - name : Trigger Codeball
63- id : codeball_baller
64- uses : sturdy-dev/codeball-action/baller@v2
65-
66-
67- # Wait for Codeball to return the status
68- - name : Get Status
69- id : codeball_status
70- uses : sturdy-dev/codeball-action/status@v2
71- with :
72- codeball-job-id : ${{ steps.codeball_baller.outputs.codeball-job-id }}
73-
74- # If Codeball approved the contribution, add a "codeball:approved" label
75- - name : Label Approved
76- uses : sturdy-dev/codeball-action/labeler@v2
77- if : ${{ steps.codeball_status.outputs.approved == 'true' }}
78- with :
79- name : " codeball:approved"
80- color : " 86efac" # green
81-
82- # If Codeball did not approve the contribution, add a "codeball:needs-review" label
83- - name : Label Needs Review
84- uses : sturdy-dev/codeball-action/labeler@v2
85- if : ${{ steps.codeball_status.outputs.approved == 'false' }}
61+ - name : Codeball
62+ uses : sturdy-dev/codeball-action@v2
8663 with :
87- name : " codeball:needs-review"
88- color : " bfdbfe" # blue
89-
64+ approvePullRequests : " false"
65+ labelPullRequestsWhenApproved : " true"
66+ labelPullRequestsWhenReviewNeeded : " true"
67+ failJobsWhenReviewNeeded : " false"
9068` ` `
9169</details>
9270
@@ -96,39 +74,21 @@ jobs:
9674 <summary>▶️ codeball-approve.yml</summary>
9775
9876` ` ` yaml
77+ name : Codeball
9978on : [pull_request]
10079
101- permissions :
102- contents : read
103- issues : write
104- pull-requests : write
105-
10680jobs :
107- codeball :
81+ codeball_job :
10882 runs-on : ubuntu-latest
10983 name : Codeball
11084 steps :
111-
112- # Start a new Codeball review job
113- # This step is asynchronous and will return a job id
114- - name : Trigger Codeball
115- id : codeball_baller
116- uses : sturdy-dev/codeball-action/baller@v2
117-
118-
119- # Wait for Codeball to return the status
120- - name : Get Status
121- id : codeball_status
122- uses : sturdy-dev/codeball-action/status@v2
123- with :
124- codeball-job-id : ${{ steps.codeball_baller.outputs.codeball-job-id }}
125-
126- # If Codeball approved the contribution, approve the PR
127- - name : Approve PR
128- uses : sturdy-dev/codeball-action/approver@v2
129- if : ${{ steps.codeball_status.outputs.approved == 'true' }}
85+ - name : Codeball
86+ uses : sturdy-dev/codeball-action@v2
13087 with :
131- message : " Codeball: LGTM! :+1:"
88+ approvePullRequests : " true"
89+ labelPullRequestsWhenApproved : " false"
90+ labelPullRequestsWhenReviewNeeded : " false"
91+ failJobsWhenReviewNeeded : " false"
13292` ` `
13393</details>
13494
13999 <summary>▶️ codeball-filter-files.yml</summary>
140100
141101` ` ` yaml
102+ name : Codeball
142103on :
143104 pull_request :
144105 # Run Codeball only if files under "/web/" has been modified (and no other files)
@@ -147,86 +108,43 @@ on:
147108 - ' !**'
148109 - ' /web/**'
149110
150- permissions :
151- contents : read
152- issues : write
153- pull-requests : write
154-
155111jobs :
156- codeball :
112+ codeball_job :
157113 runs-on : ubuntu-latest
158114 name : Codeball
159-
160115 steps :
161-
162- # Start a new Codeball review job
163- # This step is asynchronous and will return a job id
164- - name : Trigger Codeball
165- id : codeball_baller
166- uses : sturdy-dev/codeball-action/baller@v2
167-
168-
169- # Wait for Codeball to return the status
170- - name : Get Status
171- id : codeball_status
172- uses : sturdy-dev/codeball-action/status@v2
173- with :
174- codeball-job-id : ${{ steps.codeball_baller.outputs.codeball-job-id }}
175-
176- # If Codeball approved the contribution, approve the PR
177- - name : Approve PR
178- uses : sturdy-dev/codeball-action/approver@v2
179- if : ${{ steps.codeball_status.outputs.approved == 'true' }}
116+ - name : Codeball
117+ uses : sturdy-dev/codeball-action@v2
180118 with :
181- message : " Codeball: LGTM! :+1:"
119+ approvePullRequests : " true"
120+ labelPullRequestsWhenApproved : " true"
121+ labelPullRequestsWhenReviewNeeded : " false"
122+ failJobsWhenReviewNeeded : " false"
182123` ` `
183124</details>
184125
185126
186- ### Example:
127+ ### Example: Fail the Codeball Action (❌) if Codeball does not approve the contribution
187128
188129<details>
189130 <summary>▶️ codeball-fail-not-approved.yml</summary>
190131
191132` ` ` yaml
133+ name : Codeball
192134on : [pull_request]
193135
194- permissions :
195- contents : read
196- issues : write
197- pull-requests : write
198-
199136jobs :
200- codeball :
137+ codeball_job :
201138 runs-on : ubuntu-latest
202139 name : Codeball
203140 steps :
204- # Start a new Codeball review job
205- # This step is asynchronous and will return a job id
206- - name : Trigger Codeball
207- id : codeball_baller
208- uses : sturdy-dev/codeball-action/baller@v2
209-
210- # Wait for Codeball to return the status
211- - name : Get Status
212- id : codeball_status
213- uses : sturdy-dev/codeball-action/status@v2
214- with :
215- codeball-job-id : ${{ steps.codeball_baller.outputs.codeball-job-id }}
216-
217- # If Codeball approved the contribution, approve the PR
218- - name : Approve PR
219- uses : sturdy-dev/codeball-action/approver@v2
220- if : ${{ steps.codeball_status.outputs.approved == 'true' }}
141+ - name : Codeball
142+ uses : sturdy-dev/codeball-action@v2
221143 with :
222- message : ' Codeball: LGTM! :+1:'
223-
224- # If Codeball didn't approve the contribution, fail the job.
225- - name : Fail Job
226- if : ${{ steps.codeball_status.outputs.approved == 'fail' }}
227- run : |
228- echo "Not approved"
229- exit 1
144+ approvePullRequests : " true"
145+ labelPullRequestsWhenApproved : " true"
146+ labelPullRequestsWhenReviewNeeded : " false"
147+ failJobsWhenReviewNeeded : " true"
230148` ` `
231149</details>
232150
@@ -268,6 +186,6 @@ permissions:
268186
269187# ## Forks and private repositories
270188
271- By default, only pull requests from a fork does not have "write" permissions when running in GitHub Actions, and those Pull Requests can not be approved.
189+ By default, pull requests from a fork does not have "write" permissions when running in GitHub Actions, and those Pull Requests can not be approved or labeled .
272190
273191If you're using forks from a private repository, and want to use Codeball on Pull Requests created from a fork. Enable "Send write tokens to workflows from fork pull requests" on the repository ([docs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#enabling-workflows-for-private-repository-forks)).
0 commit comments