Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query git issue url to get issue status and add GIT_ISSUE_STATUS to the json #2882

Merged
merged 6 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 15 additions & 0 deletions disabledTestParser/issue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[{
"JDK_VERSION" : 17,
"JDK_IMPL" : "hotspot",
"TARGET" : "jdk_custom",
"CUSTOM_TARGET" : "java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java",
"GIT_ISSUE" : "https://github.com/adoptium/temurin-build/issues/248",
"PLATFORM" : "all"
},{
"JDK_VERSION" : 16,
"JDK_IMPL" : "openj9",
"TARGET" : "jdk_custom",
"CUSTOM_TARGET" : "java/lang/ClassLoader/Assert.java",
"GIT_ISSUE" : "https://github.com/eclipse-openj9/openj9/issues/6668",
"PLATFORM" : "x86-64_mac"
}]
40 changes: 40 additions & 0 deletions disabledTestParser/issue_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import json
import requests


def json_parser(json_obj):
jsonLoad = json.loads(json_obj)
return jsonLoad["GIT_ISSUE"]

def find_state(query_url):
params = {'accept': 'application/vnd.github.v3+json',
'state': 'all'}
try:
response = requests.get(query_url, params=params).json()
json_str = json.dumps(response)
return json.loads(json_str)["state"]
except:
print("An exception occurred! Url is invalid")

def main():
base_url = f'https://api.github.com/repos/'
f = open('issue.json',)
xius666 marked this conversation as resolved.
Show resolved Hide resolved
data = json.load(f)

for j in data:
str_json = json.dumps(j)
git_issue_url = json_parser(str_json)
repo_issueUrl = git_issue_url.replace("https://github.com/", "")
final_url = base_url + repo_issueUrl
state = find_state(final_url)
j["GIT_ISSUE_STATUS"] = state

with open('output.json', 'w', encoding='utf-8') as f:
json.dump(data, f, ensure_ascii=False, indent=4)


if __name__ == '__main__':
main()