Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

[TEST] - PR e795 #5

Merged
merged 3 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ git push --set-upstream origin "$BRANCH"

gh pr create --title "[TEST] - PR $ID" --body ""

python src/main.py
#python src/main.py
#gh pr view
#
#git checkout main
Expand Down
1 change: 1 addition & 0 deletions short_commit_sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
305a1a4
1 change: 1 addition & 0 deletions src/GitHub/outputs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import logging


def set_action_outputs(output_pairs):
Expand Down
11 changes: 3 additions & 8 deletions src/GitHub/pullrequest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests
import subprocess
import logging
from github import Github


Expand Down Expand Up @@ -52,11 +53,5 @@ def diff(self):
response = requests.get(diff_url)
return response.text


# def change_pull_request_description(pr_number, new_description):
# g = Github()
# owner, repo = get_owner_and_repo()
# repository = g.get_repo(f'{owner}/{repo}')
#
# pull_request = repository.get_pull(pr_number)
# pull_request.edit(body=new_description)
def update_description(self, new_description):
self.__pulls.edit(body=new_description)
3 changes: 2 additions & 1 deletion src/OpenAI/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import openai
import logging


class AiRequest:
Expand Down Expand Up @@ -34,7 +35,7 @@ def _template(template, template_file_path):
return " " # should exit fail

def generate_description(self, text):
data = self.__header + self.__template + "\n\n\n" + text
data = self.__header + self.__template + "\n\n" + text
openai.api_key = self.__key
response = openai.Completion.create(
model=self.__model,
Expand Down
10 changes: 5 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
This module generates a pull request description using
the OpenAI GPT-3.5 language model.
"""
import logging
import os
import sys
import logging

import configuration.logs as logs
import configuration.parse as parse
Expand Down Expand Up @@ -37,10 +37,10 @@ def main():
logging.debug(ai)
description = ai.generate_description(patch)

# #print(f"text={description}")
# print(pr.number)
# description="hey!"
# gh.change_pull_request_description(pr.number, description)
logging.debug(description)
outputs.set_action_outputs({"text": f"{description}"})

pullrequest.update_description(description)


if __name__ == '__main__':
Expand Down