[llvm] 5d39f3f - [Github] Fix github automation script on empty descriptions (#71274)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 21:46:42 PST 2023


Author: Aiden Grossman
Date: 2023-11-06T21:46:39-08:00
New Revision: 5d39f3f685f1729202296eea788304632063b7fa

URL: https://github.com/llvm/llvm-project/commit/5d39f3f685f1729202296eea788304632063b7fa
DIFF: https://github.com/llvm/llvm-project/commit/5d39f3f685f1729202296eea788304632063b7fa.diff

LOG: [Github] Fix github automation script on empty descriptions (#71274)

Before this patch, the github automation script would fail when trying
to escape the text of a PR/issue description that was empty as the
Github library returns None instead of an empty string in those
scenarios. This patch special cases this and makes the escape function
return an empty string when given a value of None.

Added: 
    

Modified: 
    llvm/utils/git/github-automation.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 52523704fe82dc8..ad1878d41193920 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -48,6 +48,11 @@ def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
 
 
 def escape_description(str):
+    # If the description of an issue/pull request is empty, the Github API
+    # library returns None instead of an empty string. Handle this here to
+    # avoid failures from trying to manipulate None.
+    if str is None:
+        return ""
     # https://github.com/github/markup/issues/1168#issuecomment-494946168
     str = html.escape(str, False)
     # '@' followed by alphanum is a user name


        


More information about the llvm-commits mailing list