-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open an issue when benchmarks fails to upload
- Loading branch information
Eric Giguere
committed
Jan 9, 2025
1 parent
f5f5f11
commit eb6c52b
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import requests | ||
import json | ||
import sys | ||
import argparse | ||
from datetime import date | ||
|
||
def open_issue(token): | ||
url = "https://api.github.com/repos/qutip/qutip-jax/issues" | ||
data = json.dumps({ | ||
"title": f"Automated tests failed on {date.today()}", | ||
"labels": ["bug"], | ||
"body": "Scheduled test failed!" | ||
}) | ||
|
||
headers = { | ||
"Accept": "application/vnd.github.v3+json", | ||
"Authorization" : f"token {token}", | ||
} | ||
|
||
post_request = requests.post(url=url, data=data, headers=headers) | ||
|
||
if post_request.status_code == 201: | ||
print("Success") | ||
|
||
else: | ||
print( | ||
"Fail:", | ||
post_request.status_code, | ||
post_request.reason, | ||
post_request.content | ||
) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="""Open an issue on failed tests.""" | ||
) | ||
parser.add_argument("token") | ||
args = parser.parse_args() | ||
print(args.token) | ||
open_issue(args.token) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |