Skip to content
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

TypeError when measuring time to first response #173

Closed
christopherlo93 opened this issue Dec 6, 2023 · 5 comments
Closed

TypeError when measuring time to first response #173

christopherlo93 opened this issue Dec 6, 2023 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers keep

Comments

@christopherlo93
Copy link

I was testing this with PRs in my org that were closed in the last two weeks:

Traceback (most recent call last):
  File "/action/workspace/issue_metrics.py", line 331, in <module>
    main()
  File "/action/workspace/issue_metrics.py", line 286, in main
    issues_with_metrics, num_issues_open, num_issues_closed = get_per_issue_metrics(
                                                              ^^^^^^^^^^^^^^^^^^^^^^
  File "/action/workspace/issue_metrics.py", line 180, in get_per_issue_metrics
    issue_with_metrics.time_to_first_response = measure_time_to_first_response(
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/action/workspace/time_to_first_response.py", line 77, in measure_time_to_first_response
    if ignore_comment(
       ^^^^^^^^^^^^^^^
  File "/action/workspace/time_to_first_response.py", line 133, in ignore_comment
    or (ready_for_review_at and comment_created_at < ready_for_review_at)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'

I have a feeling it may be a draft PR that was closed before it was ever ready for review.

@Okabe-Junya
Copy link
Contributor

I think your feeling seems to be correct. In this GitHub Actions, it appears that the time spent in draft PRs is being excluded from the calculation.

Although I haven't confirmed it, closing a draft PR without making it ready for review might trigger this bug.

@zkoppert zkoppert added bug Something isn't working good first issue Good for newcomers labels Dec 6, 2023
Copy link

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Mar 13, 2024
@zkoppert zkoppert added keep and removed Stale labels Mar 14, 2024
@lawang24
Copy link
Contributor

Hey! New here to the repo but really enjoy it. Wanted to say thanks by trying to help out a bit.

or (ready_for_review_at and comment_created_at < ready_for_review_at)
TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'

Looking at the error, ready_for_review_at exists and it'scomment_created_at that is None, causing it to break.

comment_created_at is defined as review_comment.submitted_at, which might not exist if a review is still in the PENDING state: https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request

I can try and tackle this. Would the correct behavior be to ignore reviews that are still in the pending state?

@zkoppert
Copy link
Member

Correct, we would want to ignore pending reviews.

@jmeridth
Copy link
Member

Fixed by #236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers keep
Projects
None yet
Development

No branches or pull requests

5 participants