Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
OCamlPro
osh
Commits
4bce8549
Unverified
Commit
4bce8549
authored
Oct 08, 2021
by
zapashcanon
Browse files
only cache status so one can still override parameters
parent
a6d1d436
Pipeline
#15910
passed with stages
in 8 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
src/osh.ml
src/osh.ml
+24
-24
No files found.
src/osh.ml
View file @
4bce8549
...
...
@@ -80,7 +80,7 @@ let badge_github_workflow_status =
(
Dream
.
param
"repo"
request
)
(
Dream
.
param
"workflow"
request
)
in
let
badge
,
invalid
=
let
status
,
invalid
=
match
Hashtbl
.
find_opt
tbl
url
with
|
Some
(
badge
,
timestamp
)
->
let
curr_timestamp
=
Unix
.
time
()
in
...
...
@@ -88,9 +88,9 @@ let badge_github_workflow_status =
(
badge
,
invalid
)
|
None
->
(
""
,
true
)
in
let
badge
=
let
status
=
if
not
invalid
then
Ok
badge
Ok
status
else
match
Ezcurl
.
get
~
url
()
with
|
Error
(
_code
,
msg
)
->
...
...
@@ -112,29 +112,29 @@ let badge_github_workflow_status =
match
latest_run
with
|
None
->
Error
"Invalid JSON answer"
|
Some
x
->
let
s
=
x
|>
Util
.
member
"conclusion"
|>
Util
.
to_string
in
let
open
Ocb
in
let
status
,
color
=
match
s
with
|
"success"
->
(
"Success"
,
Color
.
Green
)
|
"failure"
->
(
"Failure"
,
Color
.
Red
)
|
"neutral"
->
(
"Neutral"
,
Color
.
Grey
)
|
"cancelled"
->
(
"Cancelled"
,
Color
.
Red
)
|
"skipped"
->
(
"Skipped"
,
Color
.
Red
)
|
"timed_out"
->
(
"Timed out"
,
Color
.
Red
)
|
unknown
->
(
unknown
,
Color
.
Grey
)
in
let
badge
=
mk_badge
~
label
:
"Build"
~
color
~
style
:
Style
.
Flat
~
label_color
:
Color
.
Black
~
status
~
scale
:
1
.
request
in
Hashtbl
.
add
tbl
url
(
badge
,
Unix
.
time
()
);
Ok
badge
)
let
status
=
x
|>
Util
.
member
"conclusion"
|>
Util
.
to_string
in
Hashtbl
.
add
tbl
url
(
status
,
Unix
.
time
()
);
Ok
status
)
in
match
badge
with
|
Ok
badge
->
Dream
.
respond
~
headers
:
[
(
"Content-Type"
,
"image/svg+xml"
)
]
badge
match
status
with
|
Error
e
->
Dream
.
respond
e
|
Ok
status
->
let
open
Ocb
in
let
status
,
color
=
match
status
with
|
"success"
->
(
"Success"
,
Color
.
Green
)
|
"failure"
->
(
"Failure"
,
Color
.
Red
)
|
"neutral"
->
(
"Neutral"
,
Color
.
Grey
)
|
"cancelled"
->
(
"Cancelled"
,
Color
.
Red
)
|
"skipped"
->
(
"Skipped"
,
Color
.
Red
)
|
"timed_out"
->
(
"Timed out"
,
Color
.
Red
)
|
unknown
->
(
unknown
,
Color
.
Grey
)
in
let
badge
=
mk_badge
~
label
:
"Build"
~
color
~
style
:
Style
.
Flat
~
label_color
:
Color
.
Black
~
status
~
scale
:
1
.
request
in
Dream
.
respond
~
headers
:
[
(
"Content-Type"
,
"image/svg+xml"
)
]
badge
let
()
=
Dream
.
run
~
interface
:
"0.0.0.0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment