Skip to content

Commit 5d39f3f

Browse files
[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.
1 parent 02230e1 commit 5d39f3f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/utils/git/github-automation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
4848

4949

5050
def escape_description(str):
51+
# If the description of an issue/pull request is empty, the Github API
52+
# library returns None instead of an empty string. Handle this here to
53+
# avoid failures from trying to manipulate None.
54+
if str is None:
55+
return ""
5156
# https://github.com/github/markup/issues/1168#issuecomment-494946168
5257
str = html.escape(str, False)
5358
# '@' followed by alphanum is a user name

0 commit comments

Comments
 (0)