Closed gilberthl-mh closed 3 weeks ago
were you running this on an organization (github.com/org_name), list of repos (org/repository), or a personal namespace (zkoppert/repository)? Any other configuration options you can share?
Apologies @zkoppert , that context would have been helpful!
We currently run the step with this config:
- name: Get issue metrics
uses: github/issue-metrics@v3
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
HIDE_TIME_TO_ANSWER: true
SEARCH_QUERY: "${{ steps.prod-repos.outputs.repos }} is:pr closed:${{ env.last_month }}"
The value ${{ steps.prod-repos.outputs.repos }
evaluates to a space separated list of repo:moneyhub/${repo}
Theory: Maybe its possible that some repos have no events and so the events
object is None and then we try to iterate over it (for event in events).
Yet another theory: There is no user attached to the event so when it tries to access user["avatar_url"]
it doesn't exist because User is None
.
I'll start investigating those. @jmeridth any thoughts on these or other theories?
Thanks @zkoppert, I'll fork this repo and add some logs to run on our pipeline and see what is being caught out
Thanks @gilberthl-mh ! Appreciate the collaboration!!
I'll start investigating those. @jmeridth any thoughts on these or other theories?
@zkoppert possibly related https://github.com/sigmavirus24/github3.py/issues/988
Possible PR to fix already exists. Still deep diving to confirm.
I have found the issue that it was failing on, and it was happening for a user that has since left our organisation (I think) and is noted as a "ghost".
See attached image
@gilberthl-mh Check out https://github.com/github/issue-metrics/pull/325. That should allow us to catch this error and continue on instead of terminating the actions run.
Thanks @zkoppert, that seems to bypass the above error. I think there's another instance where it's failing when looking at review comments for measure_time_to_first_response
An error occurred processing review events. Perhaps issue contains a ghost user. 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/action/workspace/issue_metrics.py", line 436, in <module>
main()
File "/action/workspace/issue_metrics.py", line 370, in main
issues_with_metrics, num_issues_open, num_issues_closed = get_per_issue_metrics(
^^^^^^^^^^^^^^^^^^^^^^
File "/action/workspace/issue_metrics.py", line 226, in get_per_issue_metrics
measure_time_to_first_response(
File "/action/workspace/time_to_first_response.py", line 76, in measure_time_to_first_response
for review_comment in review_comments:
File "/usr/local/lib/python3.12/site-packages/github3/structs.py", line 131, in __iter__
yield cls(i)
^^^^^^
File "/usr/local/lib/python3.12/site-packages/github3/models.py", line 52, in __init__
self._update_attributes(json)
File "/usr/local/lib/python3.12/site-packages/github3/pulls.py", line 995, in _update_attributes
self.user = users.ShortUser(review["user"], self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/github3/models.py", line 52, in __init__
self._update_attributes(json)
File "/usr/local/lib/python3.12/site-packages/github3/users.py", line 309, in _update_attributes
self.avatar_url = user["avatar_url"]
~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Thanks for the update! I've added https://github.com/github/issue-metrics/pull/326 to address. Definitely let me know if anything else comes up!
Thank you very much @zkoppert, that has completely resolved the issue for us and we're able to run our action to completion 🙂
Glad to hear it!!
Describe the bug
We have been running the
issue-metrics
action for a while now and it has been running without any issues, but just recently we've been receiving the error:TypeError: 'NoneType' object is not subscriptable
The full stack trace can be found below:
To Reproduce
I am unsure how best to reproduce this, I would need to find the PR that is causing this issue but I think the print issues is done fully before it gets to this code in the stack trace.
Expected behavior
Action to run to completion
Screenshots
No response
Additional context
No response