From 954d420fb666b2f7f24b1d9583b7aee40aca5a72 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Fri, 27 Sep 2019 14:52:07 +0900 Subject: [PATCH] enhance: error handling EXTERNAL_REPOSITORY with GITHUB_TOKEN --- entrypoint.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ae1d932..482a10e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -46,15 +46,13 @@ elif [ -n "${GITHUB_TOKEN}" ]; then print_info "setup with GITHUB_TOKEN" print_error "Do not use GITHUB_TOKEN, See #9" - remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git" - - if [ -n "${PUBLISH_REPOSITORY}" ]; then - if [ "${GITHUB_REPOSITORY}" != "${PUBLISH_REPOSITORY}" ]; then - echo "can not use GITHUB_TOKEN to deploy to a different repository" - exit 1 - fi + if [ -n "${EXTERNAL_REPOSITORY}" ]; then + print_error "can not use GITHUB_TOKEN to deploy to a external repository" + exit 1 fi + remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git" + else print_error "not found ACTIONS_DEPLOY_KEY, PERSONAL_TOKEN, or GITHUB_TOKEN" exit 1