Skip to content

Commit 954d420

Browse files
committed
enhance: error handling EXTERNAL_REPOSITORY with GITHUB_TOKEN
1 parent 34d4479 commit 954d420

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

entrypoint.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ elif [ -n "${GITHUB_TOKEN}" ]; then
4646
print_info "setup with GITHUB_TOKEN"
4747
print_error "Do not use GITHUB_TOKEN, See #9"
4848

49-
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git"
50-
51-
if [ -n "${PUBLISH_REPOSITORY}" ]; then
52-
if [ "${GITHUB_REPOSITORY}" != "${PUBLISH_REPOSITORY}" ]; then
53-
echo "can not use GITHUB_TOKEN to deploy to a different repository"
54-
exit 1
55-
fi
49+
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
50+
print_error "can not use GITHUB_TOKEN to deploy to a external repository"
51+
exit 1
5652
fi
5753

54+
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git"
55+
5856
else
5957
print_error "not found ACTIONS_DEPLOY_KEY, PERSONAL_TOKEN, or GITHUB_TOKEN"
6058
exit 1

0 commit comments

Comments
 (0)