Skip to content
Merged
24 changes: 14 additions & 10 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ on:
workflow_dispatch:

jobs:
proto:
settings:
runs-on: ubuntu-latest
env:
PROTO_ENABLED: true
outputs:
go_version: ${{ steps.settings.outputs.go_version }}
buf_version: ${{ steps.settings.outputs.buf_version }}
proto_enabled: ${{ steps.settings.outputs.proto_enabled }}
steps:
- uses: actions/checkout@v6
- name: Load project settings
Expand All @@ -22,25 +24,27 @@ jobs:
set +a
echo "go_version=${GO_VERSION}" >> "$GITHUB_OUTPUT"
echo "buf_version=${BUF_VERSION}" >> "$GITHUB_OUTPUT"
echo "PROTO_ENABLED=${PROTO_ENABLED:-true}" >> "$GITHUB_ENV"
echo "proto_enabled=${PROTO_ENABLED:-true}" >> "$GITHUB_OUTPUT"
proto:
runs-on: ubuntu-latest
needs: settings
if: needs.settings.outputs.proto_enabled == 'true'
steps:
- uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "${{ steps.settings.outputs.go_version }}"
go-version: "${{ needs.settings.outputs.go_version }}"
check-latest: true
- name: Setup buf
uses: bufbuild/buf-setup-action@v1
with:
version: "${{ steps.settings.outputs.buf_version }}"
version: "${{ needs.settings.outputs.buf_version }}"
- name: Lint protos
if: env.PROTO_ENABLED != 'false'
run: buf lint
- name: Format protos
if: env.PROTO_ENABLED != 'false'
run: buf format -w
- name: Generate protos
if: env.PROTO_ENABLED != 'false'
run: buf generate
- name: Check diff
if: env.PROTO_ENABLED != 'false'
run: git diff --exit-code
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@
"mlock",
"mvdan",
"MX",
"mykey",
"myproject",
"mypy",
"mysecret",
"myuser",
"nbf",
"nethtml",
Expand Down
1 change: 1 addition & 0 deletions pkg/encoding/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func TestDecodeJSONReader(t *testing.T) {
reader := strings.NewReader(`{"name":"alpha"}`)

var result payload

err := DecodeJSONReader(reader, &result)
if err != nil {
t.Fatalf("expected decoded, got %v", err)
Expand Down
9 changes: 7 additions & 2 deletions pkg/secrets/redact.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,21 @@ func WithRedactionKeys(keys ...string) RedactorOption {
cfg.keys = make(map[string]struct{})
}

addedCount := 0

for _, key := range keys {
value := normalizeRedactionKey(key)
if value == "" {
continue
}

cfg.keys[value] = struct{}{}
if _, exists := cfg.keys[value]; !exists {
cfg.keys[value] = struct{}{}
addedCount++
}
}

if len(cfg.keys) == 0 {
if addedCount == 0 {
return ErrInvalidRedactorConfig
}

Expand Down
Loading
Loading