Unverified Commit 1b20c970 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Fix ci_url might be None (#17332)



* fix

* Update utils/notification_service.py
Co-authored-by: default avatarLysandre Debut <lysandre.debut@reseau.eseo.fr>
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: default avatarLysandre Debut <lysandre.debut@reseau.eseo.fr>
parent 6aad3872
......@@ -741,15 +741,16 @@ if __name__ == "__main__":
ci_title = os.environ.get("CI_TITLE")
ci_url = os.environ.get("CI_COMMIT_URL")
commit_number = ci_url.split("/")[-1]
ci_detail_url = f"https://api.github.com/repos/huggingface/transformers/commits/{commit_number}"
ci_details = requests.get(ci_detail_url).json()
ci_author = ci_details["author"]["login"]
if ci_title is not None:
assert ci_url is not None
ci_title = ci_title.strip().split("\n")[0].strip()
# Retrieve the PR title and author login to complete the report
commit_number = ci_url.split("/")[-1]
ci_detail_url = f"https://api.github.com/repos/huggingface/transformers/commits/{commit_number}"
ci_details = requests.get(ci_detail_url).json()
ci_author = ci_details["author"]["login"]
merged_by = None
# Find the PR number (if any) and change the url to the actual PR page.
numbers = pr_number_re.findall(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