-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[GSoC 2026] Fixing the github action Unmanaged Service Account Keys #39177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
cda6b09
22cbe00
1bd4943
cd8e0a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -248,18 +248,36 @@ def create_announcement(self, title: str, body: str, recipient: str, announcemen | |||||||||||||||||||||
| """ | ||||||||||||||||||||||
| open_issues = self._get_open_issues(title) | ||||||||||||||||||||||
| open_issues.sort(key=lambda x: x.updated_at, reverse=True) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| timestamp = __import__("datetime").datetime.now(__import__("datetime").timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC") | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Maintainability: Using inline Please import from datetime import datetime, timezoneAnd simplify this line.
Suggested change
References
|
||||||||||||||||||||||
| new_report = f"### Compliance Audit Report ({timestamp})\n{body}" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if open_issues: | ||||||||||||||||||||||
| self.logger.info(f"Issue with title '{title}' already exists: #{open_issues[0].number}") | ||||||||||||||||||||||
| announcement += f"\n\nRelated GitHub Issue: {open_issues[0].html_url}" | ||||||||||||||||||||||
| target_issue = open_issues[0] | ||||||||||||||||||||||
| self.logger.info(f"Issue with title '{title}' already exists: #{target_issue.number}") | ||||||||||||||||||||||
| announcement += f"\n\nRelated GitHub Issue: {target_issue.html_url}" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| old_body = target_issue.body or "" | ||||||||||||||||||||||
| history_marker = "### History\n<details>\n<summary>Click to expand</summary>\n\n" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if open_issues[0].body != body: | ||||||||||||||||||||||
| self.logger.info(f"Updating body of issue #{open_issues[0].number}") | ||||||||||||||||||||||
| self.update_issue_body(open_issues[0].number, body) | ||||||||||||||||||||||
| if history_marker in old_body: | ||||||||||||||||||||||
| # If history already exists, append the new report to it | ||||||||||||||||||||||
| headed = old_body.split(history_marker) | ||||||||||||||||||||||
| last_report = headed[0].strip() | ||||||||||||||||||||||
| old_history = headed[1].replace("</details>", "").strip() | ||||||||||||||||||||||
| combined_history = f"{last_report}\n\n---\n\n{old_history}" | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness/Robustness: Using Instead, split with
Suggested change
|
||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| self.logger.info(f"No changes detected for issue #{open_issues[0].number}") | ||||||||||||||||||||||
| # First time updating, turn the entire old body into history | ||||||||||||||||||||||
| combined_history = old_body.strip() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| final_body = f"{new_report}\n\n{history_marker}{combined_history}\n</details>" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| self.logger.info(f"Appending report and archiving history to existing issue #{target_issue.number}") | ||||||||||||||||||||||
| self.update_issue_body(target_issue.number, final_body) | ||||||||||||||||||||||
| self._send_email(title, announcement, recipient) | ||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| new_issue = self.create_issue(title, body) | ||||||||||||||||||||||
| self.logger.info(f"Creating new compliance issue for: {title}") | ||||||||||||||||||||||
| new_issue = self.create_issue(title, new_report) | ||||||||||||||||||||||
| announcement += f"\n\nRelated GitHub Issue: {new_issue.html_url}" | ||||||||||||||||||||||
| self._send_email(title, announcement, recipient) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -273,6 +291,13 @@ def print_announcement(self, title: str, body: str, recipient: str, announcement | |||||||||||||||||||||
| print(f"Recipient: {recipient}") | ||||||||||||||||||||||
| print(f"Announcement: {announcement}") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| print("\nSimulating GitHub issue creation...") | ||||||||||||||||||||||
| print(f"Title: {title}") | ||||||||||||||||||||||
| print(f"Body: {body}") | ||||||||||||||||||||||
| timestamp = __import__("datetime").datetime.now(__import__("datetime").timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC") | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Maintainability: Using inline Please import
Suggested change
References
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| print("\n" + "="*60) | ||||||||||||||||||||||
| print("SIMULATING GITHUB GENERAL ISSUE CREATION/UPDATE") | ||||||||||||||||||||||
| print("="*60) | ||||||||||||||||||||||
| print(f"Title: {title}\n") | ||||||||||||||||||||||
| print(f"Body:\n### Compliance Audit Report ({timestamp})") | ||||||||||||||||||||||
| print(body) | ||||||||||||||||||||||
| print("### History\n<details>\n<summary>Click to expand</summary>\n\n[... Previous reports would be collapsed here ...]\n</details>") | ||||||||||||||||||||||
| print("="*60 + "\n") | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential Runtime Error: Ensure that
datetimeis imported at the top of the file. If it is not imported, this line will raise aNameErrorat runtime.If
datetimeis not imported, please addfrom datetime import datetime, timezoneat the top of the file and update this line to use them directly.