@@ -77,6 +77,28 @@ def main(): # pragma: no cover
7777 organization , team_name , repository_list , github_connection
7878 )
7979
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+
80102 # Iterate through the repositories and open an issue/PR if dependabot is not enabled
81103 count_eligible = 0
82104 for repo in repos :
@@ -187,12 +209,14 @@ def main(): # pragma: no cover
187209 ):
188210 enable_dependabot_security_updates (ghe , repo .owner , repo .name , token )
189211
212+ link = ""
190213 if follow_up_type == "issue" :
191214 skip = check_pending_issues_for_duplicates (title , repo )
192215 if not skip :
193216 count_eligible += 1
194217 body_issue = f"{ body } \n \n ```yaml\n # { dependabot_filename_to_use } \n { dependabot_file } \n ```"
195218 issue = repo .create_issue (title , body_issue )
219+ link = issue .html_url
196220 print (f"\t Created issue { issue .html_url } " )
197221 if project_id :
198222 issue_id = get_global_issue_id (
@@ -217,6 +241,7 @@ def main(): # pragma: no cover
217241 dependabot_filename_to_use ,
218242 existing_config ,
219243 )
244+ link = pull .html_url
220245 print (f"\t Created pull request { pull .html_url } " )
221246 if project_id :
222247 pr_id = get_global_pr_id (
@@ -228,6 +253,12 @@ def main(): # pragma: no cover
228253 except github3 .exceptions .NotFoundError :
229254 print ("\t Failed to create pull request. Check write permissions." )
230255 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 )
231262
232263 print (f"Done. { str (count_eligible )} repositories were eligible." )
233264
@@ -496,5 +527,14 @@ def link_item_to_project(ghe, token, project_id, item_id):
496527 return None
497528
498529
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+
499539if __name__ == "__main__" :
500540 main () # pragma: no cover
0 commit comments