-
Notifications
You must be signed in to change notification settings - Fork 72
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
(Git-6) Use new Git Backend in Entire auto_tick flow #3004
base: main
Are you sure you want to change the base?
Conversation
@0xbe7a I think this is worth reviewing, even with limited knowledge of the codebase |
added: open PR, comment on PR
683b402
to
4c553c4
Compare
@@ -48,7 +52,7 @@ class PullRequestState(StrEnum): | |||
""" | |||
|
|||
|
|||
class PullRequestInfoHead(StrictBaseModel): | |||
class PullRequestInfoHead(ValidatedBaseModel): |
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.
Why did you relax this?
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.
In GitHubBackend.create_pull_request
, the pr_json pydantic model is directly validated on the JSON returned by the GitHub API. However, we do not want to keep all the information the API returns, mainly since these pydantic models also correspond to the data stored in cf-graph. Hence, I relaxed this to ignore any additional data returned by GitHub.
Since the direct usage of the model also prevents the code from introducing additional extra fields to the pr_json data, it's OK that the model validation test can no longer detect such extra fields when processing the cf-graph data.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3004 +/- ##
==========================================
+ Coverage 76.27% 77.40% +1.12%
==========================================
Files 115 115
Lines 12532 12948 +416
==========================================
+ Hits 9559 10022 +463
+ Misses 2973 2926 -47 ☔ View full report in Codecov by Sentry. |
) | ||
except subprocess.CalledProcessError as e: | ||
raise GitCliError("Error running git command.") from e | ||
e.stdout = replace_tokens(e.stdout, self.__hidden_tokens) |
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.
I'm not a huge fan of encoding the credentials in the remote URL and then censoring the logs. I think a better approach would be similar to how GitHub handles it in the checkout action, by setting up the 'http.https://github.com/.extraheader'
git config to include the authorization header.
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.
Yeah putting the credentials on disk is not so great too right, or did I miss something? In any case, I don't actually care either way, but if we do put credentials on disk, we'll want to ensure they get cleaned up before the python process exits. On CI, GitHub will do this for us but potentially people running locally with a token might not.
Description:
Building upon #3003, this replaces the remaining auto_tick logic to use the new git backend.
Notably, this PR ensures that the new backend is used for opening PRs and commenting on PRs.
Checklist:
Cross-refs, links to issues, etc:
#3003 should be merged first.