Skip to content

Commit aad217a

Browse files
fixing github app list scrpit
1 parent 07910f3 commit aad217a

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

list_all_github_app_in_org.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,25 @@ def list_github_apps_in_organization(organization: str):
2929
print(f'Listing GitHub Apps in {organization} failed')
3030
print(response_json)
3131
# Extract the list of dictionaries
32-
if response_json.get('installationss') is not None:
33-
list_of_installations = response_json["installations"]
34-
print(f'Found {len(list_of_installations)} GitHub App in {organization} organization')
32+
list_of_installations = response_json["installations"]
33+
print(f'Found {len(list_of_installations)} GitHub App in {organization} organization')
3534

36-
# Convert list of dictionaries to JSON string
37-
json_data = json.dumps(list_of_installations, indent=4)
35+
# Convert list of dictionaries to JSON string
36+
json_data = json.dumps(list_of_installations, indent=4)
3837

39-
# Write JSON string to a file
40-
with open("list_of_github_installations.json", "w") as file:
41-
file.write(json_data)
38+
# Write JSON string to a file
39+
with open("list_of_github_installations.json", "w") as file:
40+
file.write(json_data)
4241

43-
app_short_list = []
44-
for app in list_of_installations:
45-
app_dict = {}
46-
app_dict['id'] = app['id']
47-
app_dict['app_id'] = app['app_id']
48-
app_dict['app_slug'] = app['app_slug']
49-
app_short_list.append(app_dict)
42+
app_short_list = []
43+
for app in list_of_installations:
44+
app_dict = {}
45+
app_dict['id'] = app['id']
46+
app_dict['app_id'] = app['app_id']
47+
app_dict['app_slug'] = app['app_slug']
48+
app_short_list.append(app_dict)
5049

51-
return app_short_list
50+
return app_short_list
5251

5352
def main():
5453
""" To test the code """

0 commit comments

Comments
 (0)