-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set review data to github actions output #853
Conversation
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Description updated to latest commit (9d45e39)
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
9d45e39
to
75c4bef
Compare
Convert to draft. TODO
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Description updated to latest commit (3412095)
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
pr_agent/algo/utils.py
Outdated
def github_output(output_data: dict, key_name: str): | ||
if get_settings().github_action_config.enable_output is False: | ||
return | ||
|
||
output = os.getenv('GITHUB_OUTPUT') | ||
key_data = output_data.get(key_name, {}) | ||
with open(output, 'w') as f: | ||
f.write(f"{key_name}={json.dumps(key_data, indent=None, ensure_ascii=False)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1)
change name to 'github_action_output'
it can be confusing to call it as a generic 'github_output' name
(2) wrap everything with try-except.
see also PR-Agent feedback:
"
Environment Variable Dependency: The feature relies on the GITHUB_OUTPUT environment variable being set.
"
Will it always be set ?
(3)
change
" if get_settings().github_action_config.enable_output is False:
return"
to getter only:
if get_settings().get("github_action_config.enable_output", False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrT23 Thank you for your reivewing.
- (1) : fixed.
- (2) : fixed, refined & add test code.
I thinkGITHUB_OUTPUT
env is always available on github actions runner. Refined the output implementation based on most using codebases. (ref.1 / ref.2)
Note that this feature is implicitly disabled in the configuration if use in other than github actions. so, I think no side-effect. - (3): fixed.
Hi @idubnori , thanks for the PR. Please also update the documentation: |
Updated the doc. Please confirm it and let me know if you have any suggestions. thanks. |
User description
Add following feature under new
GITHUB_ACTION_CONFIG.ENABLE_OUTPUT
config.Set review result data to github actions output parameter .
Usage Example
Note
true
if use in github actions, otherwisefalse
Why
Convenient to be able to use the review result without parsing markdown formatted comment in next step action.
Type
enhancement, tests
Description
GITHUB_ACTION_CONFIG.ENABLE_OUTPUT
.github_output
function inutils.py
for handling the output writing process.GITHUB_ACTION_CONFIG.ENABLE_OUTPUT
setting ingithub_action_runner.py
to enable or disable the output feature based on environment variables.github_output
function inpr_reviewer.py
to output review data.test_github_output.py
to ensure the functionality works as expected under different scenarios (enabled, disabled, and unset).enable_output
configuration inconfiguration.toml
to manage this feature through settings.Changes walkthrough
utils.py
Implement GitHub Actions Output Feature
pr_agent/algo/utils.py
github_output
function to write review data to GitHub Actionsoutput.
os
module for environment variable access.pr_reviewer.py
Use GitHub Output in PR Reviewer
pr_agent/tools/pr_reviewer.py
github_output
to write review data to GitHub Actions output.github_action_runner.py
Configure GitHub Actions Output Setting
pr_agent/servers/github_action_runner.py
GITHUB_ACTION_CONFIG.ENABLE_OUTPUT
fromenvironment and set it in settings.
configuration.toml
Add Configuration for GitHub Actions Output
pr_agent/settings/configuration.toml
enable_output
configuration undergithub_action_config
.test_github_output.py
Test GitHub Actions Output Functionality
tests/unittest/test_github_output.py
github_output
function with enabled, disabled, andunset output scenarios.