This repository was archived by the owner on Jun 26, 2026. It is now read-only.
Repository navigation
Commit cd25edf
authored
fix(ci): tolerate null PR fields and honour existing area/* in pr-labeler (#17)
Two correctness bugs surfaced after the initial labeler landed:
1. Null inputs. computeLabels destructured title/body/existingLabels
with defaults, but destructuring defaults only fire on undefined.
GitHub PR payloads carry an explicit null for an empty description,
which would crash body.match() at runtime. Switched to explicit ||
fallbacks on rawTitle/rawBody/rawExisting so null on any of the three
is treated as the empty value.
2. hasArea ignored existing area/* labels. A maintainer-added area/*
followed by a scopeless retitle would re-add area/uncategorized on
top of the real area, leaving the PR with both labels until the next
edit cycle cleared the fallback. Now hasArea checks the new
derivation AND existing labels (excluding area/uncategorized itself
so a scopeless retitle of an only-uncategorized PR still reaches the
fallback path).
Five new tests pin the behaviour: null body, null title, null
existingLabels, scopeless retitle with maintainer-added area/* (no
fallback added, stale fallback removed), and the edge case where the
only existing area is area/uncategorized (fallback is not frozen in
place).
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>1 parent 92ff040 commit cd25edf
2 files changed
Lines changed: 61 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
189 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
0 commit comments