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
45a <- 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")
4243if (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" )
4547system(" git add tables/*/*.html" )
4648system(" git add data/*/*.png" )
4749system(" 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)
5759tbl_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 )
5862commentz <- sprintf(paste0(base , ' issues/%s/comments' ), a [1 ])
5963res <- GET(commentz , header )
6064warn_for_status(res )
6165info <- content(res )
6266old_body <- unlist(lapply(info , " [" , " body" ))
6367if (! 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