Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(action): ignore unversioned file (#16074)

p0ny34e25eba0afb
diff --git a/action/file.go b/action/file.go
index a9ddabd80c..a6cebe5355 100644
--- a/action/file.go
+++ b/action/file.go
@@ -1,13 +1,17 @@
package main
import (
+ "log/slog"
"os"
"path/filepath"
+ "regexp"
"strings"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
+var versionReg = regexp.MustCompile(`^\d+`)
+
func getReleaseFiles(pattern string) ([]*v1pb.Release_File, error) {
matches, err := filepath.Glob(pattern)
if err != nil {
@@ -28,11 +32,13 @@ func getReleaseFiles(pattern string) ([]*v1pb.Release_File, error) {
case strings.Contains(base, "ghost"):
t = v1pb.Release_File_DDL_GHOST
}
- version := ""
- fields := strings.Split(base, "_")
- if len(fields) > 0 {
- version = fields[0]
+
+ version := versionReg.FindString(base)
+ if version == "" {
+ slog.Warn("version not found. ignore the file", "file", m)
+ continue
}
+
files = append(files, &v1pb.Release_File{
Path: m,
Type: v1pb.ReleaseFileType_VERSIONED,