Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions utils/notification_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,23 @@ def add_path(self, path: str, gpu: str = None):
artifact_path["gpu"]
] += f"*{line}*\n_{stacktraces.pop(0)}_\n\n"

# To find the PR number in a commit title, for example, `Add AwesomeFormer model (#99999)`
pr_number_re = re.compile(r"\(#(\d+)\)$")

title = f"🤗 Results of the {ci_event} tests."
# Add PR title with a link for push CI
ci_title = os.environ.get("CI_TITLE")
commit_url = os.environ.get("CI_COMMIT_URL")
if ci_title is not None:
assert commit_url is not None
ci_title = ci_title.strip().split("\n")[0].strip()

# Find the PR number (if any) and change the url to the actual PR page.
numbers = pr_number_re.findall(ci_title)
if len(numbers) > 0:
pr_number = numbers[0]
commit_url = f"https://github.com/huggingface/transformers/pull/{pr_number}"

ci_title = f"<{commit_url}|{ci_title}>"
else:
ci_title = ""
Expand Down