@@ -50,8 +50,6 @@ if (!process.env.CI || !process.env.TRAVIS) {
50
50
const githubToken = process . env . GH_TOKEN ;
51
51
const nowToken = process . env . NOW_TOKEN ;
52
52
const discordHook = process . env . DISCORD_HOOK ;
53
- const prSha = process . env . TRAVIS_PULL_REQUEST_SHA ;
54
- const commitSha = process . env . TRAVIS_COMMIT ;
55
53
const repoSlug = process . env . TRAVIS_REPO_SLUG ;
56
54
const aliasUrl = process . env . NOW_ALIAS ;
57
55
@@ -116,7 +114,7 @@ function notifyInDiscord(err, res) {
116
114
content : buildComment ( res . context , res . url , 'https://coderplex.org' ) ,
117
115
} )
118
116
. then ( ( ) => {
119
- console . log ( `Error posted to discord` ) ;
117
+ console . log ( `Success posted to discord` ) ;
120
118
} )
121
119
. catch ( console . log . bind ( console ) ) ;
122
120
}
@@ -128,6 +126,8 @@ function buildComment(context, url, aliasUrl) {
128
126
}
129
127
130
128
function deploy ( context , sha ) {
129
+ console . log ( `context: ${ context } ` ) ;
130
+ console . log ( `sha: ${ sha } ` ) ;
131
131
if ( context === 'staging' ) {
132
132
// Send error status to github PR
133
133
ghRepo . status (
@@ -163,7 +163,7 @@ function deploy(context, sha) {
163
163
164
164
// Retrieve now.sh unique url from stdOut
165
165
const deployedUrl = getUrl ( res ) ;
166
-
166
+ console . log ( `deployedUrl: ${ deployedUrl } ` ) ;
167
167
if ( context === 'staging' ) {
168
168
// Send success status to github PR
169
169
ghRepo . status (
@@ -177,14 +177,12 @@ function deploy(context, sha) {
177
177
console . log . bind ( console ) ,
178
178
) ;
179
179
// Check and create comment on github PR abot deployment results
180
- if ( argv . comment && context === 'staging' ) {
181
- ghIssue . createComment (
182
- {
183
- body : buildComment ( context , deployedUrl ) ,
184
- } ,
185
- console . log . bind ( console ) ,
186
- ) ;
187
- }
180
+ ghIssue . createComment (
181
+ {
182
+ body : buildComment ( context , deployedUrl ) ,
183
+ } ,
184
+ console . log . bind ( console ) ,
185
+ ) ;
188
186
return ;
189
187
}
190
188
// In production alias deployment to specified alias url from now.json file or from env variable
@@ -207,9 +205,9 @@ travisAfterAll((code, err) => {
207
205
if ( err || code ) return ;
208
206
switch ( process . env . TRAVIS_EVENT_TYPE ) {
209
207
case 'pull_request' :
210
- return deploy ( 'staging' , prSha ) ;
208
+ return deploy ( 'staging' , process . env . TRAVIS_PULL_REQUEST_SHA ) ;
211
209
case 'push' :
212
- return deploy ( 'production' , commitSha ) ;
210
+ return deploy ( 'production' , process . env . TRAVIS_COMMIT ) ;
213
211
default :
214
212
break ;
215
213
}
0 commit comments