Skip to content

Commit 920afc7

Browse files
committed
feat: setup of gh action
1 parent 2d98a15 commit 920afc7

File tree

4 files changed

+103
-16
lines changed

4 files changed

+103
-16
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Container image that runs your code
2+
FROM alpine:3.10
3+
4+
# Copies your code file from your action repository to the filesystem path `/` of the container
5+
COPY entrypoint.sh /entrypoint.sh
6+
7+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
8+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
## Hi there 👋
2-
3-
<!--
4-
**code-buddy-agent/code-buddy-agent** is a ✨ _special_ ✨ repository because its `README.md` (this file) appears on your GitHub profile.
5-
6-
Here are some ideas to get you started:
7-
8-
- 🔭 I’m currently working on ...
9-
- 🌱 I’m currently learning ...
10-
- 👯 I’m looking to collaborate on ...
11-
- 🤔 I’m looking for help with ...
12-
- 💬 Ask me about ...
13-
- 📫 How to reach me: ...
14-
- 😄 Pronouns: ...
15-
- ⚡ Fun fact: ...
16-
-->
1+
# Hello world docker action
2+
3+
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
4+
5+
## Inputs
6+
7+
## `who-to-greet`
8+
9+
**Required** The name of the person to greet. Default `"World"`.
10+
11+
## Outputs
12+
13+
## `time`
14+
15+
The time we greeted you.
16+
17+
## Example usage
18+
19+
uses: actions/hello-world-docker-action@v2
20+
with:
21+
who-to-greet: 'Mona the Octocat'

action.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# action.yml
2+
name: 'CodeBuddy AI Code Review'
3+
description: 'Cut code reviews time, reduce bugs, improve your code quality with the power of LLM agents.'
4+
inputs:
5+
owner:
6+
description: 'Owner of repository'
7+
required: true
8+
repository:
9+
description: 'Name of repository'
10+
required: true
11+
pull_request_number:
12+
description: 'Identifier of pull request'
13+
required: true
14+
github_token:
15+
description: 'Personal Access token to repository'
16+
required: true
17+
code_buddy_key:
18+
description: 'Code Buddy Key to access AI Agent'
19+
required: true
20+
stack:
21+
description: 'Your stack of development'
22+
required: true
23+
total_comments:
24+
description: 'Total of comments by file'
25+
required: false
26+
outputs:
27+
response:
28+
description: 'Response of AI Agent'
29+
runs:
30+
using: 'docker'
31+
image: 'Dockerfile'
32+
args:
33+
- ${{ inputs.owner }}
34+
- ${{ inputs.repository }}
35+
- ${{ inputs.pull_request_number }}
36+
- ${{ inputs.github_token }}
37+
- ${{ inputs.code_buddy_key }}
38+
- ${{ inputs.stack }}
39+
- ${{ inputs.total_comments }}

entrypoint.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -e
5+
6+
# Read input parameters
7+
OWNER="$1"
8+
REPOSITORY="$2"
9+
PULL_REQUEST_NUMBER="$3"
10+
GITHUB_TOKEN="$4"
11+
CODE_BUDDY_KEY="$5"
12+
STACK="$6"
13+
TOTAL_COMMENTS="$7"
14+
15+
# Construct the payload for the request
16+
PAYLOAD=$(cat <<EOF
17+
{
18+
"owner": "$OWNER",
19+
"repository": "$REPOSITORY",
20+
"pullRequestNumber": "$PULL_REQUEST_NUMBER",
21+
"githubToken": "$GITHUB_TOKEN",
22+
"codeBuddyKey": "$CODE_BUDDY_KEY",
23+
"stack": "$STACK",
24+
"totalComments": ${TOTAL_COMMENTS:-null}
25+
}
26+
EOF
27+
)
28+
29+
# Make the CURL request
30+
RESPONSE=$(curl -s --location 'http://64.23.245.115:8080/v1/code-review-agent' \
31+
--header 'Content-Type: application/json' \
32+
--data "$PAYLOAD")
33+
34+
# Set the action output
35+
echo "::set-output name=response::$RESPONSE"

0 commit comments

Comments
 (0)