github: check + fail if there are no assets matching regex

Signed-off-by: unilock <unilock@fennet.rentals>
This commit is contained in:
unilock 2024-04-15 19:18:05 -04:00
parent d54da349d5
commit 979b606b1e
2 changed files with 9 additions and 0 deletions

View File

@ -134,6 +134,10 @@ func installRelease(repo Repo, release Release, regex string, pack core.Pack) er
}
}
if len(files) == 0 {
return errors.New("release doesn't have any assets matching regex")
}
if len(files) > 1 {
// TODO: also print file names
return errors.New("release has more than one asset matching regex")

View File

@ -68,6 +68,11 @@ func (u ghUpdater) CheckUpdate(mods []*core.Mod, pack core.Pack) ([]core.UpdateC
}
}
if len(newFiles) == 0 {
results[i] = core.UpdateCheck{Error: errors.New("release doesn't have any assets matching regex")}
continue
}
if len(newFiles) > 1 {
// TODO: also print file names
results[i] = core.UpdateCheck{Error: errors.New("release has more than one asset matching regex")}