From 6f3de2af18c7b6c56b170b7365948ef26f2b90cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cerqueira?= Date: Thu, 21 Oct 2021 15:09:37 +0100 Subject: [PATCH] ci(release): debug with GITHUB_TOKEN --- .github/workflows/release.yml | 6 ++++-- internal/git/mod.go | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b5f74f..2681b73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,13 +33,15 @@ jobs: run: | git config --global user.name "${{ secrets.CB_RELEASE_BOT_NAME }}" git config --global user.email "${{ secrets.CB_RELEASE_BOT_EMAIL }}" - git config --local --replace-all url.https://github.com/.insteadOf ssh://git@github.com/ - git config --local --add url.https://git:${{ steps.release-bot.outputs.token }}@github.com/.insteadOf git@github.com: + # git config --local --replace-all url.https://github.com/.insteadOf ssh://git@github.com/ + # git config --local --add url.https://git:${{ steps.release-bot.outputs.token }}@github.com/.insteadOf git@github.com: # debugging purposes cat .git/config - name: Bump Version run: git semver bump + env: + GITHUB_TOKEN: ${{ steps.release-bot.outputs.token }} - name: GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/internal/git/mod.go b/internal/git/mod.go index 116f2c5..9060790 100644 --- a/internal/git/mod.go +++ b/internal/git/mod.go @@ -10,6 +10,7 @@ import ( "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/storer" + "github.com/go-git/go-git/v5/plumbing/transport/http" ) type Commit = object.Commit @@ -134,6 +135,10 @@ func PushTagsToOrigin(repo *Repository) error { RemoteName: "origin", Progress: os.Stdout, RefSpecs: []config.RefSpec{config.RefSpec("refs/tags/*:refs/tags/*")}, + Auth: &http.BasicAuth{ + Username: "git", + Password: os.Getenv("GITHUB_TOKEN"), + }, } if err := repo.Push(pushOpts); err != nil {