File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -310,19 +310,24 @@ jobs:
310310 )
311311 fi
312312
313- prev_credential_helper=$(git config get --global credential.helper || true)
313+ prev_credential_helper=$(git config get --local credential.helper || true)
314314 if [[ -n "${prev_credential_helper}" ]]; then
315315 printf 'credential helper is already set (%s)\n' "${prev_credential_helper}"
316316 else
317+ protocol="${GITHUB_SERVER_URL%%://*}"
318+ hostname="${GITHUB_SERVER_URL#*://}"
317319 (
318320 set -x
319- git config --global credential.helper store
321+ git config --local credential.helper cache
320322 )
321- protocol="${GITHUB_SERVER_URL%%://*}"
322- hostname="${GITHUB_SERVER_URL#*://}"
323- printf '%s\n' "${protocol}://${GITHUB_ACTOR}:${PUSH_TOKEN}@${hostname}" >~/.git-credentials
323+ git credential approve <<EOF
324+ protocol=${protocol}
325+ host=${hostname}
326+ username=${GITHUB_ACTOR}
327+ password=${PUSH_TOKEN}
328+ EOF
324329 # Remove credential helper config on exit.
325- trap -- '(set -x; rm -f -- ~/.git-credentials ; git config --global --unset credential.helper || true)' EXIT
330+ trap -- '(set -x; git credential-cache exit ; git config --local --unset credential.helper || true)' EXIT
326331 fi
327332
328333 (
You can’t perform that action at this time.
0 commit comments