stale-repos icon indicating copy to clipboard operation
stale-repos copied to clipboard

Crash whilst generating report

Open skye-pp opened this issue 1 year ago • 10 comments

Describe the bug

Hi there, and happy new year 🎉

I'm trying out this action on relatively large organization (~1k repositories) and finding that it crashes out after a minute or so, in approximately the same place each time.

The traceback isn't obviously about rate limiting so I thought I'd raise an issue:

Traceback (most recent call last):
  File "/action/workspace/stale_repos.py", line 424, in <module>
    main()
    ~~~~^^
  File "/action/workspace/stale_repos.py", line 55, in main
    inactive_repos = get_inactive_repos(
        github_connection, inactive_days_threshold, organization, additional_metrics
    )
  File "/action/workspace/stale_repos.py", line 146, in get_inactive_repos
    repo_data = set_repo_data(
        repo, days_inactive, active_date_disp, visibility, additional_metrics
    )
  File "/action/workspace/stale_repos.py", line 404, in set_repo_data
    repo_data["days_since_last_release"] = get_days_since_last_release(repo)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/action/workspace/stale_repos.py", line 167, in get_days_since_last_release
    last_release = next(repo.releases())
  File "/usr/local/lib/python3.13/site-packages/github3/structs.py", line 142, in __next__
    return next(self.__i__)
  File "/usr/local/lib/python3.13/site-packages/github3/structs.py", line 131, in __iter__
    yield cls(i)
          ~~~^^^
  File "/usr/local/lib/python3.13/site-packages/github3/models.py", line 52, in __init__
    self._update_attributes(json)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/github3/repos/release.py", line 102, in _update_attributes
    self.author = users.ShortUser(release["author"], self)
                  ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/github3/models.py", line 52, in __init__
    self._update_attributes(json)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/github3/users.py", line 309, in _update_attributes
    self.avatar_url = user["avatar_url"]
                      ~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Please let me know if there's anything I can provide to help debug.

To Reproduce

Version used: v2.0.1 (d6c45761f4ee2f781251c788006d14ca48c6ec8e).

Expected behavior

N/A

Screenshots

No response

Additional context

No response

skye-pp avatar Jan 07 '25 09:01 skye-pp

@skye-pp thanks for raising this error. I'm looking into it now.

jmeridth avatar Jan 07 '25 09:01 jmeridth

Found a different issue, getting that merged and released. But we are aware of rate limiting needed (reference https://github.com/github/github-ospo/issues/77). I'll work on it this weekend. Again, thank you for raising the flag.

jmeridth avatar Jan 07 '25 10:01 jmeridth

Thanks! Just to make sure I understand, are you saying you think the error is related to rate limiting, or it was related to the separate issue you found and fixed?

skye-pp avatar Jan 07 '25 13:01 skye-pp

@skye-pp I believe your trace lends towards rate limiting. You wouldn't have authenticated successfully (when using a PAT) if it was the other issue (fixed with 2.1.0 release). If you want to pull 2.1.0 and retry, that'd be appreciated to confirm.

jmeridth avatar Jan 07 '25 15:01 jmeridth

@skye-pp I looked at this over the weekend. We have a few paths forward. I'm speaking with other maintainers on how best we want to proceed.

jmeridth avatar Jan 13 '25 13:01 jmeridth

Hey @jmeridth - any word on a path forward? 🙂

skye-pp avatar Jan 29 '25 10:01 skye-pp

@skye-pp Apologies for the delayed response. I have not forgotten about this. We do. We're going to go with ReST rate limiting. And then quick follow to see if GraphQL will just minimize the necessary queries overall. But start with ReST rate limiting first. I hope to get after this in the next day or two.

jmeridth avatar Feb 03 '25 21:02 jmeridth

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[bot] avatar Feb 25 '25 02:02 github-actions[bot]

@skye-pp I have not forgotten this

jmeridth avatar Feb 26 '25 21:02 jmeridth

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[bot] avatar Mar 20 '25 02:03 github-actions[bot]

I'm hitting the same issue. Having a operations-per-run here would be great.

1ucian0 avatar Aug 29 '25 11:08 1ucian0

@1ucian0 Can you expand on what you mean by having a operations-per-run? What exactly would that track, and how would it be helpful? Thanks for helping me understand your suggestion better.

zkoppert avatar Aug 29 '25 17:08 zkoppert

Because I thought the issue was related to rate limiting. But it seems like it is not. Here a way to reproduce it:

from github3 import GitHub
from stale_repos import get_days_since_last_release

github = GitHub()

repository = github.repository('qiskit-community', 'qiskit-qec')

print(get_days_since_last_release(repository))

It is because https://github.com/sigmavirus24/github3.py/issues/988 , when trying to fetch a release without author, I think.

1ucian0 avatar Aug 29 '25 22:08 1ucian0

@zkoppert following you lead, similar fix in https://github.com/github/stale-repos/pull/367 . Thanks!

1ucian0 avatar Aug 29 '25 23:08 1ucian0