mozilla-releng / mozilla-releng/simple-github

Enterprise Teams support

Open Beginner friendly
#196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
8
Avg merge
1d 12h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in auth.py at _get_installation_id, where the traceback shows the installation account is matched by login. Compare the enterprise account fields described in the issue and verify installation-token generation for an enterprise installation; done means the lookup no longer raises KeyError and selects the intended installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, python
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.