mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +08:00
clean: rename to github_action_output
This commit is contained in:
@ -663,7 +663,7 @@ def find_line_number_of_relevant_line_in_file(diff_files: List[FilePatchInfo],
|
|||||||
break
|
break
|
||||||
return position, absolute_position
|
return position, absolute_position
|
||||||
|
|
||||||
def github_output(output_data: dict, key_name: str):
|
def github_action_output(output_data: dict, key_name: str):
|
||||||
if get_settings().github_action_config.enable_output is False:
|
if get_settings().github_action_config.enable_output is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler
|
|||||||
from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler
|
from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler
|
||||||
from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models
|
from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models
|
||||||
from pr_agent.algo.token_handler import TokenHandler
|
from pr_agent.algo.token_handler import TokenHandler
|
||||||
from pr_agent.algo.utils import convert_to_markdown, github_output, load_yaml, ModelType
|
from pr_agent.algo.utils import convert_to_markdown, github_action_output, load_yaml, ModelType
|
||||||
from pr_agent.config_loader import get_settings
|
from pr_agent.config_loader import get_settings
|
||||||
from pr_agent.git_providers import get_git_provider
|
from pr_agent.git_providers import get_git_provider
|
||||||
from pr_agent.git_providers.git_provider import IncrementalPR, get_main_pr_language
|
from pr_agent.git_providers.git_provider import IncrementalPR, get_main_pr_language
|
||||||
@ -192,7 +192,7 @@ class PRReviewer:
|
|||||||
data = load_yaml(self.prediction.strip(),
|
data = load_yaml(self.prediction.strip(),
|
||||||
keys_fix_yaml=["estimated_effort_to_review_[1-5]:", "security_concerns:", "possible_issues:",
|
keys_fix_yaml=["estimated_effort_to_review_[1-5]:", "security_concerns:", "possible_issues:",
|
||||||
"relevant_file:", "relevant_line:", "suggestion:"])
|
"relevant_file:", "relevant_line:", "suggestion:"])
|
||||||
github_output(data, 'review')
|
github_action_output(data, 'review')
|
||||||
|
|
||||||
if 'code_feedback' in data:
|
if 'code_feedback' in data:
|
||||||
code_feedback = data['code_feedback']
|
code_feedback = data['code_feedback']
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from pr_agent.algo.utils import get_settings, github_output
|
from pr_agent.algo.utils import get_settings, github_action_output
|
||||||
|
|
||||||
class TestGitHubOutput:
|
class TestGitHubOutput:
|
||||||
def test_github_output_enabled(self, monkeypatch, tmp_path):
|
def test_github_action_output_enabled(self, monkeypatch, tmp_path):
|
||||||
get_settings().set('GITHUB_ACTION_CONFIG.ENABLE_OUTPUT', True)
|
get_settings().set('GITHUB_ACTION_CONFIG.ENABLE_OUTPUT', True)
|
||||||
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
||||||
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
||||||
key_name = 'key1'
|
key_name = 'key1'
|
||||||
|
|
||||||
github_output(output_data, key_name)
|
github_action_output(output_data, key_name)
|
||||||
|
|
||||||
with open(str(tmp_path / 'output'), 'r') as f:
|
with open(str(tmp_path / 'output'), 'r') as f:
|
||||||
env_value = f.read()
|
env_value = f.read()
|
||||||
@ -20,21 +20,21 @@ class TestGitHubOutput:
|
|||||||
assert actual_key == key_name
|
assert actual_key == key_name
|
||||||
assert actual_data == output_data[key_name]
|
assert actual_data == output_data[key_name]
|
||||||
|
|
||||||
def test_github_output_disabled(self, monkeypatch, tmp_path):
|
def test_github_action_output_disabled(self, monkeypatch, tmp_path):
|
||||||
get_settings().set('GITHUB_ACTION_CONFIG.ENABLE_OUTPUT', False)
|
get_settings().set('GITHUB_ACTION_CONFIG.ENABLE_OUTPUT', False)
|
||||||
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
||||||
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
||||||
key_name = 'key1'
|
key_name = 'key1'
|
||||||
|
|
||||||
github_output(output_data, key_name)
|
github_action_output(output_data, key_name)
|
||||||
|
|
||||||
assert not os.path.exists(str(tmp_path / 'output'))
|
assert not os.path.exists(str(tmp_path / 'output'))
|
||||||
|
|
||||||
def test_github_output_notset(self, monkeypatch, tmp_path):
|
def test_github_action_output_notset(self, monkeypatch, tmp_path):
|
||||||
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output'))
|
||||||
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
output_data = {'key1': {'value1': 1, 'value2': 2}}
|
||||||
key_name = 'key1'
|
key_name = 'key1'
|
||||||
|
|
||||||
github_output(output_data, key_name)
|
github_action_output(output_data, key_name)
|
||||||
|
|
||||||
assert not os.path.exists(str(tmp_path / 'output'))
|
assert not os.path.exists(str(tmp_path / 'output'))
|
Reference in New Issue
Block a user