|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | | -from base64 import b64decode |
4 | 3 | import json |
5 | 4 | import os |
6 | 5 | from os.path import dirname, join |
| 6 | +from base64 import b64decode |
7 | 7 |
|
8 | 8 | import github3 |
9 | 9 | from dotenv import load_dotenv |
|
32 | 32 | full_repository = repo.repository.refresh() |
33 | 33 |
|
34 | 34 | innersource_repo = repo.as_dict() |
35 | | - innersource_repo['_InnerSourceMetadata'] = {} |
36 | | - |
| 35 | + innersource_repo["_InnerSourceMetadata"] = {} |
| 36 | + |
37 | 37 | # fetch innersource.json |
38 | 38 | try: |
39 | | - content = repo.repository.file_contents('/innersource.json').content |
| 39 | + content = repo.repository.file_contents("/innersource.json").content |
40 | 40 | metadata = json.loads(b64decode(content)) |
41 | 41 |
|
42 | | - innersource_repo['_InnerSourceMetadata'] = metadata |
| 42 | + innersource_repo["_InnerSourceMetadata"] = metadata |
43 | 43 | except github3.exceptions.NotFoundError: |
44 | 44 | # innersource.json not found in repository, but it's not required |
45 | 45 | pass |
46 | 46 |
|
47 | 47 | # fetch repository participation |
48 | 48 | participation = repo.repository.weekly_commit_count() |
49 | | - innersource_repo['_InnerSourceMetadata']['participation'] = participation['all'] |
| 49 | + innersource_repo["_InnerSourceMetadata"]["participation"] = participation[ |
| 50 | + "all" |
| 51 | + ] |
50 | 52 |
|
51 | 53 | # fetch contributing guidelines |
52 | 54 | try: |
53 | 55 | # if CONTRIBUTING.md exists in the repository, link to that instead of repo root |
54 | | - content = repo.repository.file_contents('/CONTRIBUTING.md').content |
55 | | - innersource_repo['_InnerSourceMetadata']['guidelines'] = 'CONTRIBUTING.md' |
| 56 | + content = repo.repository.file_contents("/CONTRIBUTING.md").content |
| 57 | + innersource_repo["_InnerSourceMetadata"][ |
| 58 | + "guidelines" |
| 59 | + ] = "CONTRIBUTING.md" |
56 | 60 | except github3.exceptions.NotFoundError: |
57 | 61 | # CONTRIBUTING.md not found in repository, but it's not required |
58 | 62 | pass |
59 | 63 |
|
60 | 64 | # fetch repository topics |
61 | 65 | topics = repo.repository.topics() |
62 | | - innersource_repo['_InnerSourceMetadata']['topics'] = topics.names |
| 66 | + innersource_repo["_InnerSourceMetadata"]["topics"] = topics.names |
63 | 67 |
|
64 | 68 | repo_list.append(innersource_repo) |
65 | 69 |
|
|
0 commit comments