fix: prevent false link-check failures and harden health/workflow errors

Address three review findings from the Go rewrite:\n\n- checker: update PartitionLinks to only classify HTTP(S) URLs as external links.\n  This skips markdown-relative targets (for example  and anchors) so\n  non-URL entries are no longer sent to HTTP validation and do not produce\n  deterministic "unsupported protocol scheme" failures.\n\n- health command: stop ignoring LoadHealthCache errors.\n  Return a user-facing "load cache" error when the cache file is unreadable\n  or invalid instead of allowing a nil cache panic on Merge.\n\n- broken links workflow: remove masked execution behavior from the link check\n  step. Capture awesome-docker check exit code, set has_errors=true on any\n  non-zero exit, and expose the exit code in the generated issue body so\n  checker failures are visible and cannot incorrectly close the tracking issue.\n\nTest coverage updates:\n- extend checker partition test to include markdown-relative/anchor targets\n  and verify they are not treated as external URLs.\n- add cache test for invalid YAML load failure.
This commit is contained in:
Julien Bisconti
2026-02-27 23:45:13 +01:00
parent 8956f1d292
commit 8bb3147e4e
5 changed files with 49 additions and 9 deletions

View File

@@ -78,6 +78,22 @@ func TestLoadHealthCacheMissing(t *testing.T) {
}
}
func TestLoadHealthCacheInvalidYAML(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "health.yaml")
if err := os.WriteFile(path, []byte("entries:\n - url: [not yaml"), 0644); err != nil {
t.Fatal(err)
}
hc, err := LoadHealthCache(path)
if err == nil {
t.Fatal("expected error for invalid YAML")
}
if hc != nil {
t.Fatal("expected nil cache on invalid YAML")
}
}
func TestMerge(t *testing.T) {
hc := &HealthCache{
Entries: []HealthEntry{

View File

@@ -3,6 +3,7 @@ package checker
import (
"context"
"fmt"
"net/url"
"strings"
"time"
@@ -43,12 +44,20 @@ func ExtractGitHubRepo(url string) (owner, name string, ok bool) {
return parts[0], parts[1], true
}
// PartitionLinks separates URLs into GitHub repos and external links.
func isHTTPURL(raw string) bool {
u, err := url.Parse(raw)
if err != nil {
return false
}
return u.Scheme == "http" || u.Scheme == "https"
}
// PartitionLinks separates URLs into GitHub repos and external HTTP(S) links.
func PartitionLinks(urls []string) (github, external []string) {
for _, url := range urls {
if _, _, ok := ExtractGitHubRepo(url); ok {
github = append(github, url)
} else {
} else if isHTTPURL(url) {
external = append(external, url)
}
}

View File

@@ -41,6 +41,8 @@ func TestPartitionLinks(t *testing.T) {
"https://example.com/tool",
"https://github.com/moby/moby",
"https://github.com/user/repo/issues",
"dozzle",
"#projects",
}
gh, ext := PartitionLinks(urls)
if len(gh) != 2 {