diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 19826b20880..b88d42bc4f9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: go-version-file: "go.mod" - name: Initialize CodeQL - uses: github/codeql-action/init@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1 + uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -60,14 +60,14 @@ jobs: run: make - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1 + uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: category: "/language:${{ matrix.language }}" upload: false output: sarif-results - name: Upload filtered SARIF - uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1 + uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: sarif_file: sarif-results/${{ matrix.language }}.sarif category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml index 549d2db0447..4e6403aa1d8 100644 --- a/.github/workflows/govulncheck.yml +++ b/.github/workflows/govulncheck.yml @@ -27,6 +27,6 @@ jobs: go run "golang.org/x/vuln/cmd/govulncheck@$govulncheck_version" -format sarif ./... > gh.sarif - name: Upload SARIF report - uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1 + uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: sarif_file: gh.sarif diff --git a/go.mod b/go.mod index 5579ed7cf8b..7d0494476a0 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.27.1 require ( charm.land/bubbles/v2 v2.2.1 - charm.land/bubbletea/v2 v2.0.9 + charm.land/bubbletea/v2 v2.0.10 charm.land/huh/v2 v2.0.3 charm.land/lipgloss/v2 v2.0.6 github.com/AlecAivazis/survey/v2 v2.3.7 @@ -38,7 +38,7 @@ require ( github.com/in-toto/attestation v1.2.0 github.com/joho/godotenv v1.5.1 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 - github.com/klauspost/compress v1.20.0 + github.com/klauspost/compress v1.20.1 github.com/mattn/go-colorable v0.1.15 github.com/mattn/go-isatty v0.0.24 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d diff --git a/go.sum b/go.sum index d6148193b39..b79a9272be6 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ charm.land/bubbles/v2 v2.2.1 h1:Fq1+qm5hV6GkvzLQDhCBpXXE5tLgvh1PRriCLwSvIQU= charm.land/bubbles/v2 v2.2.1/go.mod h1:wdMgn+sje1KNXdwFizIWjbf328fIUBxqEmJ/vYPo8yc= -charm.land/bubbletea/v2 v2.0.9 h1:DpJCMWKgzQK8SJv4zbKKFHAI10ymWy/evClPFk0k0f8= -charm.land/bubbletea/v2 v2.0.9/go.mod h1:2SkdgoTXluXJHOUwAoRlRXF/28vklb1rFl6GcgV1/ss= +charm.land/bubbletea/v2 v2.0.10 h1:oolvo20VBpI0PfqE7iFjkZ1bx0WpmXGfnKz5Yldjq5o= +charm.land/bubbletea/v2 v2.0.10/go.mod h1:QOatcnhOjYIfxzUSTz6raF7Ex4R/rIuHa3SnBdCCpMc= charm.land/huh/v2 v2.0.3 h1:2cJsMqEPwSywGHvdlKsJyQKPtSJLVnFKyFbsYZTlLkU= charm.land/huh/v2 v2.0.3/go.mod h1:93eEveeeqn47MwiC3tf+2atZ2l7Is88rAtmZNZ8x9Wc= charm.land/lipgloss/v2 v2.0.6 h1:EaGKeuA8FvF+v2BT5VmZd2LoYLaMZJXA5n34th8nCIQ= @@ -353,8 +353,8 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA= -github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= +github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= diff --git a/pkg/cmd/repo/setdefault/setdefault.go b/pkg/cmd/repo/setdefault/setdefault.go index d4abac30925..91ead8ed1e6 100644 --- a/pkg/cmd/repo/setdefault/setdefault.go +++ b/pkg/cmd/repo/setdefault/setdefault.go @@ -105,7 +105,7 @@ func NewCmdSetDefault(f *cmdutil.Factory, runF func(*SetDefaultOptions) error) * } } - if !opts.ViewMode && !opts.IO.CanPrompt() && opts.Repo == nil { + if !opts.ViewMode && !opts.UnsetMode && !opts.IO.CanPrompt() && opts.Repo == nil { return cmdutil.FlagErrorf("repository required when not running interactively") } diff --git a/pkg/cmd/repo/setdefault/setdefault_test.go b/pkg/cmd/repo/setdefault/setdefault_test.go index abe993151cd..ec8c06c848f 100644 --- a/pkg/cmd/repo/setdefault/setdefault_test.go +++ b/pkg/cmd/repo/setdefault/setdefault_test.go @@ -24,6 +24,7 @@ func TestNewCmdSetDefault(t *testing.T) { remotes func() (context.Remotes, error) input string output SetDefaultOptions + nonTTY bool wantErr bool errMsg string }{ @@ -59,6 +60,7 @@ func TestNewCmdSetDefault(t *testing.T) { }, input: "--view", output: SetDefaultOptions{ViewMode: true}, + nonTTY: true, }, { name: "unset flag", @@ -67,6 +69,17 @@ func TestNewCmdSetDefault(t *testing.T) { }, input: "--unset", output: SetDefaultOptions{UnsetMode: true}, + nonTTY: true, + }, + { + name: "no argument when not running interactively", + gitStubs: func(cs *run.CommandStubber) { + cs.Register(`git rev-parse --git-dir`, 0, ".git") + }, + input: "", + nonTTY: true, + wantErr: true, + errMsg: "repository required when not running interactively", }, { name: "run from non-git directory", @@ -114,7 +127,7 @@ func TestNewCmdSetDefault(t *testing.T) { for _, tt := range tests { io, _, _, _ := iostreams.Test() io.SetStdoutTTY(true) - io.SetStdinTTY(true) + io.SetStdinTTY(!tt.nonTTY) io.SetStderrTTY(true) remotesFunc := tt.remotes if remotesFunc == nil { @@ -157,6 +170,7 @@ func TestNewCmdSetDefault(t *testing.T) { assert.NoError(t, err) assert.Equal(t, tt.output.Repo, gotOpts.Repo) assert.Equal(t, tt.output.ViewMode, gotOpts.ViewMode) + assert.Equal(t, tt.output.UnsetMode, gotOpts.UnsetMode) }) } }