tenseleyflow/shithub / 7c9dd0d

Browse files

actions/trigger + scripts: gofumpt + drop unused placeholder + lint-unused bash 3.2 shim (S41b)

- gofumpt fixes across the trigger package + dispatch handler
- drop the stale 'startedAtNow' placeholder var in enqueue.go that
the lint-unused script flagged as a dead 'silence unused import'
shim (it was originally a hint for S41c+, but never used)
- scripts/lint-unused.sh: ${ALLOWED_FILES[@]:-} so an empty
array doesn't trip set -u under macOS bash 3.2
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
7c9dd0d4789b042a805e99e30cca0daf62ffb0f8
Parents
b5d3edd
Tree
63bbcac

7 changed files

StatusFile+-
M cmd/shithubd/worker.go 1 1
M internal/actions/trigger/enqueue.go 0 8
M internal/actions/trigger/glob.go 3 3
M internal/actions/trigger/glob_test.go 2 2
M internal/actions/trigger/match.go 9 9
M internal/web/handlers/repo/actions_dispatch.go 2 1
M scripts/lint-unused.sh 4 2
cmd/shithubd/worker.gomodified
@@ -17,13 +17,13 @@ import (
1717
 
1818
 	"github.com/spf13/cobra"
1919
 
20
+	"github.com/tenseleyFlow/shithub/internal/actions/trigger"
2021
 	"github.com/tenseleyFlow/shithub/internal/auth/audit"
2122
 	"github.com/tenseleyFlow/shithub/internal/auth/email"
2223
 	"github.com/tenseleyFlow/shithub/internal/auth/secretbox"
2324
 	"github.com/tenseleyFlow/shithub/internal/infra/config"
2425
 	"github.com/tenseleyFlow/shithub/internal/infra/db"
2526
 	"github.com/tenseleyFlow/shithub/internal/infra/storage"
26
-	"github.com/tenseleyFlow/shithub/internal/actions/trigger"
2727
 	"github.com/tenseleyFlow/shithub/internal/webhook"
2828
 	"github.com/tenseleyFlow/shithub/internal/worker"
2929
 	"github.com/tenseleyFlow/shithub/internal/worker/jobs"
internal/actions/trigger/enqueue.gomodified
@@ -8,7 +8,6 @@ import (
88
 	"errors"
99
 	"fmt"
1010
 	"log/slog"
11
-	"time"
1211
 
1312
 	"github.com/jackc/pgx/v5"
1413
 	"github.com/jackc/pgx/v5/pgtype"
@@ -364,10 +363,3 @@ func marshalPermissions(p workflow.Permissions) ([]byte, error) {
364363
 	}
365364
 	return json.Marshal(out)
366365
 }
367
-
368
-// startedAtNow is a small helper used by tests + future re-run callers
369
-// to set started_at on insert (S41c+ scenarios). Not currently used by
370
-// Enqueue — runs start in queued state.
371
-var _ = func() pgtype.Timestamptz {
372
-	return pgtype.Timestamptz{Time: time.Now(), Valid: true}
373
-}
internal/web/handlers/repo/actions_dispatch.gomodified
@@ -42,6 +42,7 @@ type dispatchRequest struct {
4242
 const dispatchMaxBody = 64 * 1024
4343
 
4444
 // repoActionsDispatch implements
45
+//
4546
 //	POST /{owner}/{repo}/actions/workflows/{file}/dispatches
4647
 //
4748
 // 204 on success; the trigger pipeline runs synchronously here
scripts/lint-unused.shmodified
@@ -41,8 +41,10 @@ if [ -z "$matches" ]; then
4141
   exit 0
4242
 fi
4343
 
44
-# Strip allowlisted files.
45
-for allowed in "${ALLOWED_FILES[@]}"; do
44
+# Strip allowlisted files. ${arr[@]:-} guards against bash 3.2's
45
+# unbound-empty-array behavior under set -u (macOS default shell).
46
+for allowed in "${ALLOWED_FILES[@]:-}"; do
47
+  [ -z "$allowed" ] && continue
4648
   matches=$(echo "$matches" | grep -v "^${allowed}:" || true)
4749
 done
4850