diff --git a/action.yml b/action.yml index c40d304..71363ca 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,9 @@ runs: shell: bash - id: install + env: + GIT_USER: ${{ inputs.git-user }} + GIT_USER_EMAIL: ${{ inputs.git-user-email }} run: ${GITHUB_ACTION_PATH}/install.sh shell: bash @@ -62,7 +65,5 @@ runs: if: ${{ inputs.install-only != 'true' }} run: | ${GITHUB_ACTION_PATH}/cog.sh \ - "${{ inputs.git-user }}" \ - "${{ inputs.git-user-email }}" \ "${{ inputs.command }}" \ "${{ inputs.args }}" diff --git a/cog.sh b/cog.sh index f56f06a..1187d15 100755 --- a/cog.sh +++ b/cog.sh @@ -2,16 +2,9 @@ set -a -GIT_USER="${1}" -GIT_USER_EMAIL="${2}" -COMMAND="${3}" -ARGS="${4}" - -echo "Setting git user : ${GIT_USER}" -git config --global user.name "${GIT_USER}" - -echo "Setting git user email ${GIT_USER_EMAIL}" -git config --global user.email "${GIT_USER_EMAIL}" +COMMAND="${1}" +shift +ARGS="${*}" cog --version diff --git a/install.sh b/install.sh index d5745ee..646e610 100755 --- a/install.sh +++ b/install.sh @@ -45,3 +45,13 @@ else tar --strip-components=1 -xzf $TAR "$ARCH-$PLATFORM/cog" fi cd "$CUR_DIR" || exit + +if ! git config --get user.name; then + echo "Setting git user : ${GIT_USER}" + git config --global user.name "${GIT_USER}" +fi + +if ! git config --get user.email; then + echo "Setting git email : ${GIT_USER_EMAIL}" + git config --global user.email "${GIT_USER_EMAIL}" +fi