1
1
#! /usr/bin/env node
2
2
/* eslint-disable camelcase */
3
- console . log ( `PR: ${ process . env . TRAVIS_PULL_REQUEST } ` ) ;
4
3
const github = require ( 'octonode' ) ;
5
4
const normalizeUrl = require ( 'normalize-url' ) ;
6
5
const spawn = require ( 'cross-spawn' ) ;
@@ -25,7 +24,7 @@ if (!nowToken) {
25
24
throw new Error ( 'Missing required environment variable NOW_TOKEN' ) ;
26
25
}
27
26
28
- console . log ( `PR: ${ process . env . TRAVIS_PULL_REQUEST } ` ) ;
27
+ console . log ( process . env . TRAVIS_PULL_REQUEST ) ;
29
28
30
29
const client = github . client ( githubToken ) ;
31
30
const ghRepo = client . repo ( process . env . TRAVIS_REPO_SLUG ) ;
@@ -42,7 +41,7 @@ function noop() {}
42
41
43
42
function getUrl ( content ) {
44
43
const urls = content . match ( urlRegex ( ) ) || [ ] ;
45
- console . log ( `PR: ${ process . env . TRAVIS_PULL_REQUEST } ` ) ;
44
+
46
45
return urls . map ( url => normalizeUrl ( url . trim ( ) . replace ( / \. + $ / , '' ) ) ) [ 0 ] ;
47
46
}
48
47
@@ -104,14 +103,18 @@ function deploy(context, sha) {
104
103
105
104
child . on ( 'close' , ( ) => {
106
105
const target_url = alias || getUrl ( stdout ) ;
107
- console . log ( `PR: ${ process . env . TRAVIS_PULL_REQUEST } ` ) ;
108
106
if ( ghPR ) {
109
- const comment = `(Note: This is autogenerated through Travis build) New Staging URL : ${ target_url } ` ;
110
- console . log ( comment ) ;
107
+ const comment = `
108
+ ### Δ Now ${ context } deployment complete
109
+ - ✅ **Build Passed**
110
+ - 🚀 **Staging URL** : ${ target_url }
111
+ ---
112
+ Note: **This is autogenerated through Travis build**
113
+ ` ;
111
114
ghPR . createComment (
112
115
{
113
116
body : comment ,
114
- in_reply_to : 1 ,
117
+ in_reply_to : 147402206 ,
115
118
} ,
116
119
( err , res ) => {
117
120
console . log ( err , res ) ;
0 commit comments