Unverified Commit 8600d770 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Use the PR URL in CI report (#17269)


Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 3fb82f74
......@@ -732,6 +732,9 @@ if __name__ == "__main__":
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")
......@@ -739,6 +742,13 @@ if __name__ == "__main__":
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 = ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment