Skip to content

Commit 155ab79

Browse files
committed
improve logging and rename gh action job name
1 parent e1c780f commit 155ab79

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.github/generate_codeowners.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def determine_point_of_contact(gh_session, extension_name, extension_file_conten
167167
else:
168168
committer = None
169169
point_of_contact = committer
170-
170+
logging.info("Found more than one contributor, so determining point of contact by whoever accepted the latest pull request \n")
171+
logging.info("Point of contact: " + point_of_contact)
171172
return point_of_contact
172173

173174
def process_extensions():
@@ -214,3 +215,4 @@ def generate_codeowners_file(extension_data, output_file="CODEOWNERS"):
214215
if __name__ == "__main__":
215216

216217
generate_codeowners_file(result_df, output_file="NEW_CODEOWNERS")
218+
logging.info('Generating CODEOWNERS file \n \n')

.github/notify_extension_managers.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
from github import Github
88
import json
99

10+
11+
# Configure the logger
12+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
13+
1014
# Get the GitHub token from the environment variable
1115
access_token = os.environ.get('GITHUB_TOKEN')
1216

1317
g = Github(access_token)
1418
repo = g.get_repo("vkt1414/ExtensionsIndex")
1519

16-
# Define the target extension name
17-
slicerExtensionName = 'IDCBrowser'
18-
20+
logging.info("Calling slicer cdash api to get the build info for all extensions")
1921
# API data retrieval and processing
2022
api_url = f"https://slicer.cdash.org/api/v1/index.php?project=SlicerPreview"
2123
response = requests.get(api_url)
@@ -53,7 +55,7 @@
5355
api_df['ErrorSum'] = api_df['ConfigureErrors'] + api_df['CompilationErrors'] + api_df['TestFail']
5456
api_df['WarningSum'] = api_df['ConfigureWarnings'] + api_df['CompilationWarnings']
5557
else:
56-
print(f"Failed to retrieve data. Status code: {response.status_code}")
58+
logging.error(f"Failed to retrieve data. Status code: {response.status_code}")
5759

5860
# Process the CODEOWNERS file
5961
# url = "https://raw.githubusercontent.com/vkt1414/ExtensionsIndex/main/CODEOWNERS"
@@ -184,7 +186,7 @@
184186
# Check if the issue title matches the pattern and is not in the list
185187
for issue in existing_issues:
186188
if header in issue.title and extension_name not in extensions_with_issues_list:
187-
print(f'Closing issue for {extension_name}')
189+
logging.info(f'Closing issue for {extension_name}')
188190
# Add a comment
189191
issue.create_comment("No errors or warnings found anymore, so closing this issue.")
190192
# Close the issue
@@ -206,11 +208,11 @@
206208
while True:
207209
try:
208210
new_issue = repo.create_issue(title=header, body=body)
209-
print(f"Issue created for {extension_name} - {new_issue.html_url}")
211+
logging.info(f"Issue created for {extension_name} - {new_issue.html_url}")
210212
time.sleep(30)
211213
break
212214
except Exception as e:
213-
print(header)
214-
print(body)
215-
print(f"Failed to create issue: {e}")
215+
logging.error(header)
216+
logging.error(body)
217+
logging.error(f"Failed to create issue: {e}")
216218
time.sleep(30)

.github/workflows/notify_code_owners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- cron: 0 12 */1 * *
77

88
jobs:
9-
calculate_errors:
9+
notifier:
1010
runs-on: ubuntu-latest
1111

1212
steps:

0 commit comments

Comments
 (0)