Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 1869547

Browse files
committed
fix some gh issues in travis script
1 parent 6ac5151 commit 1869547

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

scripts/deploy.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function getUrl(content) {
7272
return urls.map(url => normalizeUrl(url.trim().replace(/\.+$/, '')))[0];
7373
}
7474

75-
const baseArgs = ['--token', nowToken];
75+
const baseArgs = ['--token', nowToken, '--name', 'coderplex-app'];
7676

7777
const nowArgs = ['--no-clipboard'];
7878

@@ -103,7 +103,7 @@ function notifyInDiscord(err, res) {
103103
.post(discordHook, {
104104
username: `${repoSlug.replace('/', '-')}-BOT`,
105105
content: `Deploymet failed check travis logs here https://travis-ci.org/coderplex/coderplex/builds/${process
106-
.env.TRAVIS_BUILD_ID}`,
106+
.env.TRAVIS_BUILD_ID}#L538`,
107107
})
108108
.then(() => {
109109
console.log(`Error posted to discord`);
@@ -128,30 +128,34 @@ function buildComment(context, url, aliasUrl) {
128128
}
129129

130130
function deploy(context, sha) {
131-
// Send error status to github PR
132-
ghRepo.status(
133-
sha,
134-
{
135-
context,
136-
state: 'pending',
137-
description: `Δ Now ${context} deployment pending`,
138-
},
139-
console.log.bind(console),
140-
);
131+
if (context === 'staging') {
132+
// Send error status to github PR
133+
ghRepo.status(
134+
sha,
135+
{
136+
context,
137+
state: 'pending',
138+
description: `Δ Now ${context} deployment pending`,
139+
},
140+
console.log.bind(console),
141+
);
142+
}
141143
// Initiate deployment process
142144
runNow([...baseArgs, ...nowArgs], (code, res) => {
143145
// Remember, process code: 0 means success else failure in unix/linux
144146
if (code) {
145-
// Send error status to github PR
146-
ghRepo.status(
147-
sha,
148-
{
149-
context,
150-
state: 'error',
151-
description: `Δ Now ${context} deployment failed`,
152-
},
153-
console.log.bind(console),
154-
);
147+
if (context === 'staging') {
148+
// Send error status to github PR
149+
ghRepo.status(
150+
sha,
151+
{
152+
context,
153+
state: 'error',
154+
description: `Δ Now ${context} deployment failed`,
155+
},
156+
console.log.bind(console),
157+
);
158+
}
155159
// Notify in discord
156160
notifyInDiscord(true);
157161
return console.log(`now process exited with code ${code}`);
@@ -173,7 +177,7 @@ function deploy(context, sha) {
173177
console.log.bind(console),
174178
);
175179
// Check and create comment on github PR abot deployment results
176-
if (argv.comment) {
180+
if (argv.comment && context === 'staging') {
177181
ghIssue.createComment(
178182
{
179183
body: buildComment(context, deployedUrl),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy