@@ -77,11 +77,15 @@ def login(
77
77
78
78
# Decide how to login. If app set, prefer this
79
79
if self .gh_app_id and self .gh_app_private_key :
80
- logging .debug ("Logged in via app %s" , self .gh_app_id )
80
+ logging .debug ("Logging in via app %s" , self .gh_app_id )
81
81
auth = Auth .AppAuth (app_id = self .gh_app_id , private_key = self .gh_app_private_key )
82
82
app = GithubIntegration (auth = auth )
83
- installation = app .get_installations ()[ 0 ]
83
+ installation = app .get_org_installation ( org = orgname )
84
84
self .gh = installation .get_github_for_installation ()
85
+ logging .debug ("Logged in via app installation %s" , installation .id )
86
+
87
+ logging .debug ("Getting access token for installation %s" , installation .id )
88
+ self .gh_token = app .get_access_token (installation_id = installation .id ).token
85
89
elif self .gh_token :
86
90
logging .debug ("Logging in as user with PAT" )
87
91
self .gh = Github (auth = Auth .Token (self .gh_token ))
@@ -90,6 +94,7 @@ def login(
90
94
logging .error ("No GitHub token or App ID+private key provided" )
91
95
sys .exit (1 )
92
96
97
+ logging .debug ("Gathering data from organization '%s'" , orgname )
93
98
self .org = self .gh .get_organization (orgname )
94
99
logging .debug ("Gathered data from organization '%s' (%s)" , self .org .login , self .org .name )
95
100
0 commit comments