Skip to content

Commit 7898a06

Browse files
committed
fix(nx-heroku): handle pipelines warning
1 parent 0930881 commit 7898a06

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/nx-heroku/src/executors/common/heroku/pipelines.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { logger } from '@nrwl/devkit';
33
import { Environment } from '../constants';
44
import { exec, parseJsonString } from '../utils';
55
import { getAppName } from './apps';
6-
import { HerokuError } from './error';
6+
import { HerokuError, shouldHandleHerokuError } from './error';
77

88
export function getPipelineName(options: {
99
appNamePrefix?: string;
@@ -44,7 +44,8 @@ export async function pipelineExists(options: {
4444
const { stdout, stderr } = await exec(`heroku pipelines --json`, {
4545
encoding: 'utf-8',
4646
});
47-
stderr && logger.error(new HerokuError(stderr));
47+
shouldHandleHerokuError(stderr, stdout) &&
48+
logger.error(new HerokuError(stderr));
4849
const pipelines = parseJsonString(stdout).map((pipeline) => pipeline?.name);
4950
return pipelines.includes(pipelineName);
5051
}
@@ -67,11 +68,12 @@ export async function addAppToPipeline(options: {
6768
environment: Environment;
6869
}): Promise<void> {
6970
const { appName, pipelineName, environment } = options;
70-
const { stderr } = await exec(
71+
const { stderr, stdout } = await exec(
7172
`heroku pipelines:add ${pipelineName} --app ${appName} --stage ${environment}`,
7273
{ encoding: 'utf-8' }
7374
);
74-
stderr && logger.warn(HerokuError.cleanMessage(stderr));
75+
shouldHandleHerokuError(stderr, stdout) &&
76+
logger.warn(HerokuError.cleanMessage(stderr));
7577
}
7678

7779
export async function promoteApp(options: {
@@ -98,6 +100,7 @@ export async function promoteApp(options: {
98100
const { stdout, stderr } = await exec(
99101
`heroku pipelines:promote --app ${sourceAppName} --to ${appName}`
100102
);
101-
stderr && logger.warn(HerokuError.cleanMessage(stderr));
103+
shouldHandleHerokuError(stderr, stdout) &&
104+
logger.warn(HerokuError.cleanMessage(stderr));
102105
return stdout;
103106
}

0 commit comments

Comments
 (0)