(subject: string)
| 256 | } |
| 257 | |
| 258 | export function parseConventionalSubject(subject: string): ParsedSubject { |
| 259 | const match = /^([a-z]+)(?:\(([^)]+)\))?(!)?:\s+(.+)$/.exec(subject); |
| 260 | if (!match) { |
| 261 | return { |
| 262 | type: "other", |
| 263 | summary: subject, |
| 264 | breaking: false, |
| 265 | }; |
| 266 | } |
| 267 | |
| 268 | return { |
| 269 | type: match[1], |
| 270 | scope: match[2], |
| 271 | summary: match[4], |
| 272 | breaking: match[3] === "!", |
| 273 | }; |
| 274 | } |
| 275 | |
| 276 | function extractPrNumber(subject: string) { |
| 277 | return /\(#(\d+)\)$/.exec(subject)?.[1]; |