Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c69ae1

Browse files
committed
test again if comment works from travis
1 parent 715048a commit 2c69ae1

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

scripts/now.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#! /usr/bin/env node
22
/* eslint-disable camelcase */
3+
console.log(`PR: ${process.env.TRAVIS_PULL_REQUEST}`);
34
const github = require('octonode');
45
const normalizeUrl = require('normalize-url');
56
const spawn = require('cross-spawn');
@@ -24,7 +25,7 @@ if (!nowToken) {
2425
throw new Error('Missing required environment variable NOW_TOKEN');
2526
}
2627

27-
console.log(process.env.TRAVIS_PULL_REQUEST);
28+
console.log(`PR: ${process.env.TRAVIS_PULL_REQUEST}`);
2829

2930
const client = github.client(githubToken);
3031
const ghRepo = client.repo(process.env.TRAVIS_REPO_SLUG);
@@ -41,7 +42,7 @@ function noop() {}
4142

4243
function getUrl(content) {
4344
const urls = content.match(urlRegex()) || [];
44-
45+
console.log(`PR: ${process.env.TRAVIS_PULL_REQUEST}`);
4546
return urls.map(url => normalizeUrl(url.trim().replace(/\.+$/, '')))[0];
4647
}
4748

@@ -103,24 +104,11 @@ function deploy(context, sha) {
103104

104105
child.on('close', () => {
105106
const target_url = alias || getUrl(stdout);
106-
107-
ghRepo.status(
108-
sha,
109-
{
110-
context,
111-
target_url,
112-
state: 'success',
113-
description: `Δ Now ${context} deployment complete`,
114-
},
115-
noop,
116-
);
117107
if (ghPR) {
118108
const comment = `
119-
### Δ Now ${context} deployment complete
120-
- ✅ **Build Passed**
121-
- 🚀 **Staging URL** : ${target_url}
122-
---
123-
Note: **This is autogenerated through Travis build**
109+
Δ Now ${context} deployment complete
110+
Staging URL : ${target_url}
111+
Note: This is autogenerated through Travis build
124112
`;
125113
ghPR.createComment(
126114
{
@@ -131,6 +119,16 @@ function deploy(context, sha) {
131119
} else {
132120
console.log('No PR found');
133121
}
122+
ghRepo.status(
123+
sha,
124+
{
125+
context,
126+
target_url,
127+
state: 'success',
128+
description: `Δ Now ${context} deployment complete`,
129+
},
130+
noop,
131+
);
134132
});
135133
}
136134

0 commit comments

Comments
 (0)