diff --git a/index.sh b/index.sh index a747c12..bf06a49 100644 --- a/index.sh +++ b/index.sh @@ -51,10 +51,14 @@ health_check() { } config_github_token() { - REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" - git remote add publisher $REMOTE_REPO || true - git config user.name "GitHub Actions" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + if [[ $(git config user.email) == '41898282+github-actions[bot]@users.noreply.github.com'* ]]; then + echo "Already config github token" + else + REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git remote add publisher $REMOTE_REPO || true + git config user.name "GitHub Actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + fi } split_version() { TAG_NAME=$1 diff --git a/src/utils.sh b/src/utils.sh index 44a75d1..6be8e62 100644 --- a/src/utils.sh +++ b/src/utils.sh @@ -3,8 +3,12 @@ health_check() { } config_github_token() { - REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" - git remote add publisher $REMOTE_REPO || true - git config user.name "GitHub Actions" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + if [[ $(git config user.email) == '41898282+github-actions[bot]@users.noreply.github.com'* ]]; then + echo "Already config github token" + else + REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git remote add publisher $REMOTE_REPO || true + git config user.name "GitHub Actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + fi }