-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Refine PR Builder Code #5933
Refine PR Builder Code #5933
Conversation
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.
Solid changes, just a couple questions.
readthedocs/core/views/hooks.py
Outdated
|
||
if external_version: | ||
if not created: |
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'd switch this logic around, and do if created
. It just reads a bit cleaner.
|
||
if external_version: | ||
if not created: | ||
# identifier will change if there is a new commit to the Pull/Merge Request | ||
if external_version.identifier != identifier: | ||
external_version.identifier = identifier | ||
external_version.save() |
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.
We should probably log in this case too (eg. updated external version)
(<a data-bind="attr: {href: commit_url}"><span data-bind="text: commit">{{ build.commit }}</span></a>) | ||
{% else %} | ||
(<span data-bind="text: commit">{{ build.commit }}</span>) |
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.
Does this break the JS code that tries to update commit_url
if it doesn't exist? I don't know how knockout.js handles this, but we might also need to check for it on that side.
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.
Okay I'll check 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.
I have checked. there is no error on the browsers console window. and commit_url
does always exist. but set to None
when conditions are not met.
readthedocs/projects/tasks.py
Outdated
@@ -578,18 +578,21 @@ def run_build(self, docker, record): | |||
|
|||
if self.build_env.failed: | |||
self.send_notifications(self.version.pk, self.build['id']) | |||
# send build failure status to git Status API | |||
# if the build failed, send build failure status to git Status API | |||
# to show status report on the providers pull/merge request UI. |
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.
This is still just explaining what the code does. We can just remove these comments, we don't need to explain anything here.
readthedocs/core/views/hooks.py
Outdated
if created: | ||
log.info( | ||
'(Create External Version) Added Version: [%s] ', ' '.join( | ||
external_version.slug |
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 are we calling join
on a slug?
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.
Opps! I was doing something else forgot to remove it sorry.
This PR Will work on improving the code for PR builder by updating the code suggested in code reviews