From e475cbf961146065b446123069ee388ff1992849 Mon Sep 17 00:00:00 2001 From: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Date: Mon, 17 Aug 2026 22:13:29 -0600 Subject: [PATCH] fix(docs): handle failed release-notes fetch in home.html Hugo build home.html fetched the latest GitHub release via resources.GetRemote without wrapping it in `try`, so an unauthenticated GitHub API rate-limit response (403 Forbidden) on CI runners aborted the entire docs build. Wrap the fetch in `try` and fall back to an empty release name (no changelog chip) with a warnf, mirroring the existing resilient handling in _partials/header/header.html. The other GetRemote callers (header.html, _markup/render-image.html) already handle errors this way. Co-Authored-By: Claude Opus 4.8 --- docs/layouts/home.html | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/docs/layouts/home.html b/docs/layouts/home.html index 7b05bb81f3..46354cf0f6 100644 --- a/docs/layouts/home.html +++ b/docs/layouts/home.html @@ -1,19 +1,24 @@ {{ define "main" }} {{ $url := "https://api.github.com/repos/DefectDojo/django-DefectDojo/releases/latest" }} -{{ $resource := resources.GetRemote $url }} {{ $releaseName := "" }} -{{ if $resource }} - {{ $release := $resource | transform.Unmarshal | default dict }} - {{ if $release.name }} - {{ $releaseName = $release.name }} +{{/* Best-effort: the release chip depends on an unauthenticated GitHub API + call, which is rate-limited (403 Forbidden) on shared CI runners. + Wrap the fetch in `try` so a failed request degrades to "no chip" + instead of failing the whole build (Resource.Err was removed in + Hugo v0.141.0 in favor of the `try` keyword). */}} +{{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ warnf "Release notes fetch failed from %s: %s" $url . }} + {{ else with .Value }} + {{ $release := . | transform.Unmarshal | default dict }} + {{ with $release.name }} + {{ $releaseName = . }} + {{ else }} + {{ warnf "Could not parse release name from %s (not valid JSON or missing field)" $url }} + {{ end }} {{ else }} - {{ printf "⚠️ Could not parse release name (not valid JSON or missing field)\n" | warnf }} - {{ printf "Media Type: %s\n" $resource.MediaType | warnf }} - {{ $contentPreview := substr $resource.Content 0 500 }} - {{ printf "Content Preview (first 500 chars):\n%s\n" $contentPreview | warnf }} + {{ warnf "Release notes fetch returned no resource from %s" $url }} {{ end }} -{{ else }} - {{ printf "❌ Release Notes Fetch failed from: %s\n" $url | warnf }} {{ end }}