Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli,action): when process fails, make exit code 1 #81

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

code-suggester $INPUT_COMMAND \
if code-suggester $INPUT_COMMAND \
--upstream-repo="$INPUT_UPSTREAM_REPO" \
--upstream-owner="$INPUT_UPSTREAM_OWNER" \
--description="$INPUT_DESCRIPTION" \
Expand All @@ -24,4 +24,8 @@ code-suggester $INPUT_COMMAND \
--message="$INPUT_MESSAGE" \
--force="$INPUT_FORCE" \
--maintainers-can-modify="$INPUT_MAINTAINERS_CAN_MODIFY" \
--git-dir="$INPUT_GIT_DIR"
--git-dir="$INPUT_GIT_DIR"; then
exit 0
else
exit 1
chingor13 marked this conversation as resolved.
Show resolved Hide resolved
fi
9 changes: 8 additions & 1 deletion src/bin/code-suggester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import * as yargs from 'yargs';
import {CREATE_PR_COMMAND, main} from './workflow';
import {logger} from '../logger';

// tslint:disable:no-unused-expression
// yargs actually is a used expression. TS-lint does not detect it.
Expand Down Expand Up @@ -103,4 +104,10 @@ yargs
/**
* Parse yargs, get change object, invoke framework-core library!
*/
main();
main().catch(err => {
logger.error(err);
/* eslint-disable no-process-exit */
// If just rethrow, the application exists with code 0.
// Need exit code 1 to fail GitHub Actions step if the process fails.
process.exit(1);
});