Skip to content

Enterprise support #196

Description

@shtrom

If using an app which has been installed at an enterprise level, there is a failure is auth.py looking for the account login.

  File "/home/shtrom/work/reviewer-selector/src/reviewer_selector/github.py", line 54, in async_generate_github_token
    token = await inst_auth.get_token()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shtrom/work/reviewer-selector/.venv/lib/python3.12/site-packages/simple_github/auth.py", line 200, in get_token
    return await anext(self._generator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shtrom/work/reviewer-selector/.venv/lib/python3.12/site-packages/simple_github/auth.py", line 13, in anext
    return await ait.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/shtrom/work/reviewer-selector/.venv/lib/python3.12/site-packages/simple_github/auth.py", line 169, in _gen_installation_token
    installation_id = await self._get_installation_id()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shtrom/work/reviewer-selector/.venv/lib/python3.12/site-packages/simple_github/auth.py", line 146, in _get_installation_id
    if installation["account"]["login"] == self.owner:
       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'login'

This is because enterprises have an account.slug rather than an account.owner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions