From 11cd5e9130812e7e739abb046baa2b292cf1d1c3 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Mon, 10 Jul 2023 19:01:31 -0400 Subject: [PATCH] fix: fixes empty token error in entrypoint and logs and error for the use case Signed-off-by: Jennifer Power --- entrypoint.sh | 2 +- trestlebot/cli.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b27e4dfe..9cf7f6c6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -54,7 +54,7 @@ else exit 1 fi - command+=" --with-token <<<\"${GITHUB_TOKEN}\"" + command+=" --with-token - <<<\"${GITHUB_TOKEN}\"" fi exec 3>&1 diff --git a/trestlebot/cli.py b/trestlebot/cli.py index 365e4f95..cc4ef9cb 100644 --- a/trestlebot/cli.py +++ b/trestlebot/cli.py @@ -230,7 +230,11 @@ def run() -> None: ) sys.exit(1) - git_provider = GitHub(access_token=args.with_token) + if not args.with_token: + logger.error("with-token value cannot be empty") + sys.exit(1) + + git_provider = GitHub(access_token=args.with_token.read().strip()) exit_code: int = 0