Skip to content

Commit

Permalink
Restore git global config
Browse files Browse the repository at this point in the history
`setup-git-redirect.sh` is needed for tests, because go needs SSH
authentication, when downloading modules dependencies. The redirect
script, though, does not revert the global changes done to the git
config (in that case: SSH instead of HTTPS). The `checkout` action,
on the other hand, needs the HTTPS for checkout, because the SSH key at the
beginning of the action is no longer available, it was properly cleaned
up in the `webfactory/ssh-agent` post clean up.

Implementing workaround as in webfactory/ssh-agent#184
  • Loading branch information
damyan committed Oct 5, 2023
1 parent 75bb53c commit 042448f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
- name: Restore git global config
if: always()
run: |
MATCH=$(grep -o 'git@.*github\.com:' ~/.gitconfig)
git config --global --remove-section url.${MATCH}
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ jobs:
ssh-private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- run: ./hack/setup-git-redirect.sh
- run: make test
- name: Restore git global config
if: always()
run: |
MATCH=$(grep -o 'git@.*github\.com:' ~/.gitconfig)
git config --global --remove-section url.${MATCH}

0 comments on commit 042448f

Please sign in to comment.