@@ -59,24 +59,36 @@ jobs:
5959 /^Errors in / {
6060 file=$3
6161 gsub("^/home/runner/work/UmbracoDocs/UmbracoDocs/", "", file)
62- print "\n**Broken links found in : " file " **" >> "lychee/comment.md"
62+ current_file = file
63+ has_errors = 0
6364 next
6465 }
6566
66- /\[ ERROR\]/ {
67+ /Error : ERROR\]/ {
6768 # Skip anchor errors for #umbraco-[number] patterns
6869 if ($0 ~ /#umbraco-[0-9]+/) next
6970
71+ # Print file header if this is the first error for this file
72+ if (current_file != "" && has_errors == 0) {
73+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
74+ has_errors = 1
75+ }
76+
7077 msg = $0
71- sub(/^- \[ \] /, "", msg)
72- sub(/^\[ERROR\] /, "", msg)
78+ sub(/^Error : ERROR\] /, "", msg)
7379 gsub("^file:///home/runner/work/UmbracoDocs/UmbracoDocs/", "", msg)
7480 gsub(/\|/, "\\|", msg) # escape Markdown pipe
7581 print "\n⚓ Anchor not found → " msg "\n" >> "lychee/comment.md"
7682 next
7783 }
7884
7985 /\[404\]/ {
86+ # Print file header if this is the first error for this file
87+ if (current_file != "" && has_errors == 0) {
88+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
89+ has_errors = 1
90+ }
91+
8092 msg = $0
8193 sub(/^- \[ \] /, "", msg)
8294 sub(/^\[404\] /, "", msg)
8698 }
8799
88100 /\[301\]|\[302\]/ {
101+ # Print file header if this is the first error for this file
102+ if (current_file != "" && has_errors == 0) {
103+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
104+ has_errors = 1
105+ }
106+
89107 msg = $0
90108 sub(/^- \[ \] /, "", msg)
91109 sub(/^\[(301|302)\] /, "", msg)
@@ -98,6 +116,12 @@ jobs:
98116 # Skip 522 errors from issues.umbraco.org
99117 if ($0 ~ /issues\.umbraco\.org/) next
100118
119+ # Print file header if this is the first error for this file
120+ if (current_file != "" && has_errors == 0) {
121+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
122+ has_errors = 1
123+ }
124+
101125 msg = $0
102126 sub(/^- \[ \] /, "", msg)
103127 sub(/^\[522\] /, "", msg)
@@ -110,6 +134,12 @@ jobs:
110134 # Skip 502 errors from umbraco.com
111135 if ($0 ~ /umbraco\.com/) next
112136
137+ # Print file header if this is the first error for this file
138+ if (current_file != "" && has_errors == 0) {
139+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
140+ has_errors = 1
141+ }
142+
113143 msg = $0
114144 sub(/^- \[ \] /, "", msg)
115145 sub(/^\[502\] /, "", msg)
@@ -119,6 +149,12 @@ jobs:
119149 }
120150
121151 /Timeout/ && !/Timeouts/ {
152+ # Print file header if this is the first error for this file
153+ if (current_file != "" && has_errors == 0) {
154+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
155+ has_errors = 1
156+ }
157+
122158 msg = $0
123159 sub(/^- \[ \] /, "", msg)
124160 gsub(/\|/, "\\|", msg) # escape pipe just in case
@@ -128,6 +164,12 @@ jobs:
128164
129165 # catch-all for any other errors
130166 /^\- \[ \] \[[0-9]+\]/ {
167+ # Print file header if this is the first error for this file
168+ if (current_file != "" && has_errors == 0) {
169+ print "\n**Broken links found in : " current_file " **" >> "lychee/comment.md"
170+ has_errors = 1
171+ }
172+
131173 msg = $0
132174 sub(/^- \[ \] /, "", msg)
133175 gsub(/\|/, "|", msg)
0 commit comments