-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore insallation for owner some times (#263)
* fix: ignore insallation for owner some times This is a problem with the 'sync repos' button in the UI. It only affects getting the token for a OWNER (if it's for a repo it's correct). Sadly this affects `sync_teams` and `sync_repos` tasks. If the owner decides to sync we should use the owner's token, even if there is an installation app for that owner. The extra logic helps us do that. * hotfix: don't override old integration completely We want to fallback to the old installation_id if the repo claims to be covered. This is because there's an uncovered edge case in the ghapp installations if the owner doesn't have ALL selected and adds a new one to it.
- Loading branch information
1 parent
632c3f0
commit 51444f2
Showing
6 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import logging | ||
|
||
from shared.github import InvalidInstallationError | ||
from shared.github import get_github_integration_token as _get_github_integration_token | ||
|
||
from helpers.cache import cache | ||
from helpers.exceptions import RepositoryWithoutValidBotError | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@cache.cache_function(ttl=480) | ||
def get_github_integration_token(service, integration_id=None): | ||
try: | ||
return _get_github_integration_token(service, integration_id=integration_id) | ||
except InvalidInstallationError: | ||
log.warning("Failed to get installation token") | ||
raise RepositoryWithoutValidBotError() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters