diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c85bc3..1612349 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,14 +14,14 @@ jobs: uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: - go-version: "1.25.x" + go-version-file: go.mod - name: Run tests - run: go test ./internal/... + run: go test ./... - name: Run golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: latest + version: "v2.10.1" diff --git a/internal/git/archive.go b/internal/git/archive.go index dea6ac1..9fe04d9 100644 --- a/internal/git/archive.go +++ b/internal/git/archive.go @@ -86,6 +86,13 @@ func CreateArchive(path, remote, branch, gitUserName, gitUserEmail string, w int return fmt.Errorf("failed to configure git user.name to %q: %w", gitUserName, err) } + cmd = exec.Command("git", "config", "push.autoSetupRemote", "true") + cmd.Dir = tempRoot + err = cmd.Run() + if err != nil { + return fmt.Errorf("failed to configure git push.autoSetupRemote: %w", err) + } + cmd = exec.Command("git", "checkout", "-b", branch) cmd.Dir = tempRoot err = cmd.Run() diff --git a/internal/git/archive_test.go b/internal/git/archive_test.go index 7e1d8c1..af6ed0a 100644 --- a/internal/git/archive_test.go +++ b/internal/git/archive_test.go @@ -137,6 +137,13 @@ func TestCreateArchive(t *testing.T) { output, err = cmd.Output() require.NoError(t, err) require.Equal(t, userEmail, strings.TrimSpace(string(output))) + + // Check push.autoSetupRemote + cmd = exec.Command("git", "config", "push.autoSetupRemote") + cmd.Dir = appDir + output, err = cmd.Output() + require.NoError(t, err) + require.Equal(t, "true", strings.TrimSpace(string(output))) }) t.Run("fails on non-git directory", func(t *testing.T) {