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
4
5
a <- commandArgs(TRUE )
5
6
# gistr is a good reference for talking to the github API via httr
6
7
# https://github.com/ropensci/gistr/blob/master/R/zzz.R
@@ -42,6 +43,7 @@ system("touch table.R")
42
43
if (system(" make" ) != 0L ) stop(" Failed to 'make' test table" )
43
44
44
45
# add, commit, push to gh-pages branch of plotly-test-table
46
+ system(" git add index.html" )
45
47
system(" git add tables/*/*.html" )
46
48
system(" git add data/*/*.png" )
47
49
system(" git add data/*/*.log" )
@@ -55,13 +57,14 @@ system(paste("git push -q", repo, "gh-pages"))
55
57
# post comment if a link to this SHA doesn't exist
56
58
# (needed since Travis randomly re-builds stuff)
57
59
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 )
58
62
commentz <- sprintf(paste0(base , ' issues/%s/comments' ), a [1 ])
59
63
res <- GET(commentz , header )
60
64
warn_for_status(res )
61
65
info <- content(res )
62
66
old_body <- unlist(lapply(info , " [" , " body" ))
63
67
if (! any(grepl(tbl_link , old_body ))) {
64
- msg <- sprintf(" New test table created at %s" , tbl_link )
65
68
json <- jsonlite :: toJSON(list (body = msg ), auto_unbox = TRUE )
66
69
httr :: POST(url = commentz , header , body = json , encode = " json" )
67
70
} else {
0 commit comments