Skip to content

Commit ab1967e

Browse files
committed
More informative comment
1 parent 9a8c2e8 commit ab1967e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

inst/testscripts/comment.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# first argument should be the pull request number (TRAVIS_PULL_REQUEST)
2-
# second should be the travis build ID (TRAVIS_BUILD_ID)
3-
# third should be the github authentication token
1+
# first argument is the pull request number (TRAVIS_PULL_REQUEST)
2+
# second is travis build ID (TRAVIS_BUILD_ID)
3+
# third is the commit SHA1 currently being tested (TRAVIS_COMMIT)
4+
# fourth is the github authentication token
45
a <- commandArgs(TRUE)
56
# gistr is a good reference for talking to the github API via httr
67
# https://github.com/ropensci/gistr/blob/master/R/zzz.R
@@ -42,6 +43,7 @@ system("touch table.R")
4243
if (system("make") != 0L) stop("Failed to 'make' test table")
4344

4445
# add, commit, push to gh-pages branch of plotly-test-table
46+
system("git add index.html")
4547
system("git add tables/*/*.html")
4648
system("git add data/*/*.png")
4749
system("git add data/*/*.log")
@@ -55,13 +57,14 @@ system(paste("git push -q", repo, "gh-pages"))
5557
# post comment if a link to this SHA doesn't exist
5658
# (needed since Travis randomly re-builds stuff)
5759
tbl_link <- sprintf("http://ropensci.github.io/plotly-test-table/tables/%s/index.html", a[3])
60+
msg <- sprintf("Commit %s was successfully merged with %s (master) to create %s. A visual testing table comparing %s with %s \n %s",
61+
info$head$sha, info$base$sha, a[3], info$base$sha, a[3], tbl_link)
5862
commentz <- sprintf(paste0(base, 'issues/%s/comments'), a[1])
5963
res <- GET(commentz, header)
6064
warn_for_status(res)
6165
info <- content(res)
6266
old_body <- unlist(lapply(info, "[", "body"))
6367
if (!any(grepl(tbl_link, old_body))) {
64-
msg <- sprintf("New test table created at %s", tbl_link)
6568
json <- jsonlite::toJSON(list(body = msg), auto_unbox = TRUE)
6669
httr::POST(url = commentz, header, body = json, encode = "json")
6770
} else {

0 commit comments

Comments
 (0)