@@ -77,6 +77,28 @@ def main(): # pragma: no cover
77
77
organization , team_name , repository_list , github_connection
78
78
)
79
79
80
+ # Setting up the action summary content
81
+ summary_content = f"""
82
+ ## 🚀 Job Summary
83
+ - **Organization:** { organization }
84
+ - **Follow Up Type:** { follow_up_type }
85
+ - **Dry Run:** { dry_run }
86
+ - **Enable Security Updates:** { enable_security_updates }
87
+ """
88
+ # Add optional parameters to the summary
89
+ if project_id :
90
+ project_link = f"https://github.com/orgs/{ organization } /projects/{ project_id } "
91
+ summary_content += f"- **Project ID:** [{ project_id } ]({ project_link } )\n "
92
+ if batch_size :
93
+ summary_content += f"- **Batch Size:** { batch_size } \n "
94
+
95
+ # Add the updated repositories table header
96
+ summary_content += (
97
+ "\n \n ## 📋 Updated Repositories\n \n "
98
+ "| Repository | 🔒 Security Updates Enabled | 🔄 Follow Up Type | 🔗 Link |\n "
99
+ "| --- | --- | --- | --- |\n "
100
+ )
101
+
80
102
# Iterate through the repositories and open an issue/PR if dependabot is not enabled
81
103
count_eligible = 0
82
104
for repo in repos :
@@ -187,12 +209,14 @@ def main(): # pragma: no cover
187
209
):
188
210
enable_dependabot_security_updates (ghe , repo .owner , repo .name , token )
189
211
212
+ link = ""
190
213
if follow_up_type == "issue" :
191
214
skip = check_pending_issues_for_duplicates (title , repo )
192
215
if not skip :
193
216
count_eligible += 1
194
217
body_issue = f"{ body } \n \n ```yaml\n # { dependabot_filename_to_use } \n { dependabot_file } \n ```"
195
218
issue = repo .create_issue (title , body_issue )
219
+ link = issue .html_url
196
220
print (f"\t Created issue { issue .html_url } " )
197
221
if project_id :
198
222
issue_id = get_global_issue_id (
@@ -217,6 +241,7 @@ def main(): # pragma: no cover
217
241
dependabot_filename_to_use ,
218
242
existing_config ,
219
243
)
244
+ link = pull .html_url
220
245
print (f"\t Created pull request { pull .html_url } " )
221
246
if project_id :
222
247
pr_id = get_global_pr_id (
@@ -228,6 +253,12 @@ def main(): # pragma: no cover
228
253
except github3 .exceptions .NotFoundError :
229
254
print ("\t Failed to create pull request. Check write permissions." )
230
255
continue
256
+ # Append the repository to the summary content
257
+ summary_content += f"| { repo .full_name } | { '✅' if enable_security_updates else '❌' } | { follow_up_type } | [Link]({ link } ) |\n "
258
+
259
+ print (f"Done. { str (count_eligible )} repositories were eligible." )
260
+ # Append the summary content to the GitHub step summary file
261
+ append_to_github_summary (summary_content )
231
262
232
263
print (f"Done. { str (count_eligible )} repositories were eligible." )
233
264
@@ -496,5 +527,14 @@ def link_item_to_project(ghe, token, project_id, item_id):
496
527
return None
497
528
498
529
530
+ def append_to_github_summary (content , summary_file = "summary.md" ):
531
+ """
532
+ Append content to the GitHub step summary file
533
+ """
534
+ if summary_file :
535
+ with open (summary_file , "a" , encoding = "utf-8" ) as f :
536
+ f .write (content + "\n " )
537
+
538
+
499
539
if __name__ == "__main__" :
500
540
main () # pragma: no cover
0 commit comments