From 62f096f54cc6a72396e3f99d5b6de5e67344fb26 Mon Sep 17 00:00:00 2001 From: sergiochan Date: Thu, 12 Mar 2026 08:54:38 -0700 Subject: [PATCH 1/3] ci: checkout PR head on pull_request_target runs --- .github/workflows/codetests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/codetests.yml b/.github/workflows/codetests.yml index 247d286..77c5796 100644 --- a/.github/workflows/codetests.yml +++ b/.github/workflows/codetests.yml @@ -13,6 +13,9 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v6 + with: + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/setup-go@v6 with: go-version: 'stable' @@ -33,6 +36,9 @@ jobs: GOOS: ${{ matrix.os }} steps: - uses: actions/checkout@v6 + with: + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/setup-go@v6 with: go-version: 'stable' @@ -54,6 +60,9 @@ jobs: GOOS: ${{ matrix.os }} steps: - uses: actions/checkout@v6 + with: + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/setup-go@v6 with: go-version: 'stable' From 7bdf719158ccb831216b7d3657f5998965025f4c Mon Sep 17 00:00:00 2001 From: sergiochan Date: Thu, 12 Mar 2026 09:17:16 -0700 Subject: [PATCH 2/3] ci: split checkout logic by event type --- .github/workflows/codetests.yml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codetests.yml b/.github/workflows/codetests.yml index 77c5796..59937bb 100644 --- a/.github/workflows/codetests.yml +++ b/.github/workflows/codetests.yml @@ -12,10 +12,15 @@ jobs: os: [ubuntu, macos, windows] runs-on: ${{ matrix.os }}-latest steps: - - uses: actions/checkout@v6 + - name: checkout PR head (pull_request_target) + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v6 with: - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.pull_request.head.sha || github.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.sha }} + - name: checkout branch (push) + if: github.event_name == 'push' + uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version: 'stable' @@ -35,10 +40,15 @@ jobs: env: GOOS: ${{ matrix.os }} steps: - - uses: actions/checkout@v6 + - name: checkout PR head (pull_request_target) + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v6 with: - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.pull_request.head.sha || github.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.sha }} + - name: checkout branch (push) + if: github.event_name == 'push' + uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version: 'stable' @@ -59,10 +69,15 @@ jobs: env: GOOS: ${{ matrix.os }} steps: - - uses: actions/checkout@v6 + - name: checkout PR head (pull_request_target) + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v6 with: - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.pull_request.head.sha || github.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.sha }} + - name: checkout branch (push) + if: github.event_name == 'push' + uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version: 'stable' From 40ff3b004e9fb846144346ba5748f940001138ed Mon Sep 17 00:00:00 2001 From: sergiochan Date: Thu, 12 Mar 2026 16:05:30 -0700 Subject: [PATCH 3/3] ui: satisfy varnamelen and wrapcheck in dlgs --- pkg/ui/dlgs.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/ui/dlgs.go b/pkg/ui/dlgs.go index 80312ad..d2bef98 100644 --- a/pkg/ui/dlgs.go +++ b/pkg/ui/dlgs.go @@ -27,21 +27,21 @@ func Warning(title, msg string) (bool, error) { } // Error wraps an error dialog. -func Error(title, msg string, v ...any) (bool, error) { +func Error(title, msg string, args ...any) (bool, error) { if !HasGUI() { return true, nil } - return dialogResult(zenity.Error(fmt.Sprintf(msg, v...), zenity.Title(title))) + return dialogResult(zenity.Error(fmt.Sprintf(msg, args...), zenity.Title(title))) } // Info wraps an info dialog. -func Info(title, msg string, v ...any) (bool, error) { +func Info(title, msg string, args ...any) (bool, error) { if !HasGUI() { return true, nil } - return dialogResult(zenity.Info(fmt.Sprintf(msg, v...), zenity.Title(title))) + return dialogResult(zenity.Info(fmt.Sprintf(msg, args...), zenity.Title(title))) } // Entry wraps a text-entry dialog. @@ -54,12 +54,15 @@ func Entry(title, msg, val string) (string, bool, error) { if errors.Is(err, zenity.ErrCanceled) { return val, false, nil } + if err != nil { + return entry, false, fmt.Errorf("zenity entry: %w", err) + } - return entry, err == nil, err + return entry, true, nil } // Question wraps a question dialog. -func Question(title string, defaultCancel bool, text string, v ...any) (bool, error) { +func Question(title string, defaultCancel bool, text string, args ...any) (bool, error) { if !HasGUI() { return true, nil } @@ -69,5 +72,5 @@ func Question(title string, defaultCancel bool, text string, v ...any) (bool, er opts = append(opts, zenity.DefaultCancel()) } - return dialogResult(zenity.Question(fmt.Sprintf(text, v...), opts...)) + return dialogResult(zenity.Question(fmt.Sprintf(text, args...), opts...)) }