-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathjson2htmlrunner.py
37 lines (34 loc) · 1.41 KB
/
json2htmlrunner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
os.system('pip install json2html')
# import json2html
from json2html import *
import json
f = open('./validation-dashboard/result.json', encoding='utf-8')
infoFromJson = json.load(f)
build_direction = "LEFT_TO_RIGHT"
table_attributes = {"style": "width:100%"}
table = json2html.convert(json = infoFromJson)
f = open( 'docs/validation-result.html', 'w' )
f.write( table )
f.close()
f = open('docs/validation-result.html', 'a')
f.write("""<link rel="stylesheet" href="validation-result.css" type="text/css" media="all">
<script>
window.onload = function color() {
var value = document.getElementsByTagName("td");
for (var j = 0; j < value.length; j++) {
if (value[j].innerHTML == "fail") {
value[j].style.backgroundColor = "#ff8080";
}
if (value[j].innerHTML == "Access reqd") {
value[j].style.backgroundColor = "#ffffcc";
}
if (value[j].innerHTML == "NA") {
value[j].style.backgroundColor = "#7f7f7f";
}
}
}
</script>
<p> Note : These are the <a href="https://github.com/Azure/actions/blob/main/docs/validations-action-repo.md"> validations </a> against which the action repositories are tested. </p>
""")
f.close()