Skip to content

Commit

Permalink
Drop idea of a root language (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlk committed Jul 7, 2023
1 parent 913891d commit 5312faf
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/robin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPEN_AI_API_KEY: ${{ secrets.OPEN_AI_API_KEY }}
root_language: "bash"
gpt_model_name: "gpt-4"
files_to_ignore: |
"README.md"
"assets/*"
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ With those steps complete, Robin AI will automatically run every time a pull req
| `OPEN_AI_API_KEY` | Yes | N/A | An API key from Open AI's [developer portal](https://platform.openai.com/account/api-keys). |
| `gpt_model_name` | No | `gpt-3.5-turbo` | The name of the GPT model to use for text generation. |
| `github_api_url` | No | `https://api.github.com` | The URL for the Github API endpoint. (Only relevant to enterprise customers.) |
| `root_language` | No | to infer | The primary coding language of the project. |
| `coding_principles` | No | readability, maintainability, single responsibility principle, DRY principle | The main coding principles to uphold. |
| `ignored_principles`| No | code comments, heredoc comments, unused imports | The coding principles to ignore. |
| `files_to_ignore` | No | (empty string) | A whitespace delimited list of files to ignore. |
Expand Down
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ inputs:
description: 'URL to the API of your Github Server, only necessary for Github Enterprise customers'
required: false
default: 'https://api.github.com'
root_language:
description: 'The primary language of the repository'
required: false
default: 'to infer'
coding_principles:
description: 'The main points of feedback and code principles to maintain'
required: false
Expand All @@ -39,7 +35,6 @@ runs:
- --open_ai_api_key=${{ inputs.OPEN_AI_API_KEY }}
- --gpt_model_name=${{ inputs.gpt_model_name }}
- --github_api_url=${{ inputs.github_api_url }}
- --root_language=${{ inputs.root_language }}
- --coding_principles=${{ inputs.coding_principles }}
- --ignored_principles=${{ inputs.ignored_principles }}
- --files_to_ignore=${{ inputs.files_to_ignore }}
Expand Down
8 changes: 3 additions & 5 deletions src/gpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
gpt::prompt_model() {
local -r git_diff="$1"
local -r initial_prompt=$(cat <<EOF
root_language: $2
coding_principles: $3
ignored_principles: $4
coding_principles: $2
ignored_principles: $3
Pretend you're the pull request reviewer on our software engineering team. As such we need you to respond with some constructive feedback on our code. \
Your main contribution to the team is providing crisp constructive feedback on how we can improve our code's quality. The code is primarily written in \
"root_language".\n\
Your main contribution to the team is providing crisp constructive feedback on how we can improve our code's quality.\n\
The code will come as a git-diff. If a file is deleted, do not give feedback on it.\n\
You will first give feedback in the form of a score between 0-100. The number will estimate how likely the code change will be accepted. Assume the \
team only accepts high level production code, so they reject most initial code changes. Do not give a justification for your 0-100 score.\n\
Expand Down
4 changes: 2 additions & 2 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source "$HOME_DIR/src/gpt.sh"
##? Auto-reviews a Pull Request
##?
##? Usage:
##? main.sh --github_token=<token> --open_ai_api_key=<token> --gpt_model_name=<name> --github_api_url=<url> --root_language=<text> --coding_principles=<text> --ignored_principles=<text> --files_to_ignore=<files>
##? main.sh --github_token=<token> --open_ai_api_key=<token> --gpt_model_name=<name> --github_api_url=<url> --coding_principles=<text> --ignored_principles=<text> --files_to_ignore=<files>
main() {
eval "$(/root/bin/docpars -h "$(grep "^##?" "$HOME_DIR/src/main.sh" | cut -c 5-)" : "$@")"

Expand All @@ -26,7 +26,7 @@ main() {
exit
fi

local -r gpt_response=$(gpt::prompt_model "$commit_diff" "$root_language" "$coding_principles" "$ignored_principles" )
local -r gpt_response=$(gpt::prompt_model "$commit_diff" "$coding_principles" "$ignored_principles" )

if [ -z "$gpt_response" ]; then
echoerr "GPT's response was NULL. Double check your API key and billing details."
Expand Down

0 comments on commit 5312faf

Please sign in to comment.