Skip to content

Commit 90ce119

Browse files
authored
bug and tolerance fig in PR commenter (#6)
1 parent 9b6550f commit 90ce119

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

utils/pr_commenter.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868

6969

7070
""" Replace old files with new and push to new branch"""
71-
function replace_and_push_files(org, origin, ID, new_branch_name)
71+
function replace_and_push_files(res, org, origin, new_branch_name)
7272
# Create dir for temporary figures
7373
dir = joinpath(Pkg.devdir(), "ControlExamplePlots")
7474
cd(dir)
@@ -102,7 +102,7 @@ function get_message(res, org, old_commit, new_branch_name)
102102
fig_name = basename(r.refFilename)
103103
# Symbol in front of number
104104
diff = (isdefined(r, :diff) && isa(r.diff, Number)) ? r.diff : 1.0
105-
symbol = ( diff < 0.15 ? good : (diff < 0.3 ? warning : error))
105+
symbol = ( diff < 0.015 ? good : (diff < 0.03 ? warning : error))
106106
# Number/message we print
107107
status = (isdefined(r, :diff) && isa(r.diff, Number)) ? round(r.diff, digits=3) : string(r.status)
108108
# Append figure to message
@@ -112,7 +112,7 @@ function get_message(res, org, old_commit, new_branch_name)
112112
end
113113

114114
""" Post comment with result to original PR """
115-
function post_comment(org, message)
115+
function post_comment(org, ID, message)
116116
token = ENV["ACCESS_TOKEN_BOT"]
117117
auth = GitHub.authenticate(token)
118118
#Push the comment
@@ -155,15 +155,15 @@ try
155155
old_commit, new_branch_name = create_ControlExamplePlots_branch(ID)
156156

157157
println("running replace_and_push_files")
158-
replace_and_push_files(org, origin, ID, new_branch_name)
158+
replace_and_push_files(res, org, origin, new_branch_name)
159159

160160
println("running get_message")
161161
message = get_message(res, org, old_commit, new_branch_name)
162162

163163
#### Post Comment
164164
import GitHub
165165
println("running post_comment")
166-
post_comment(org, message)
166+
post_comment(org, ID, message)
167167
println("Done!")
168168
catch
169169
println("BUILD FAILED!")
@@ -172,7 +172,7 @@ catch
172172

173173
import GitHub
174174
println("running post_comment")
175-
post_comment(org, message)
175+
post_comment(org, ID, message)
176176
println("Build failed, comment added to PR.")
177177
# Throw error to log
178178
rethrow()

0 commit comments

Comments
 (0)