(options: {
number: number;
label: string;
currentLabels: readonly string[];
})
| 11188 | } |
| 11189 | |
| 11190 | function tryAddOptionalLabel(options: { |
| 11191 | number: number; |
| 11192 | label: string; |
| 11193 | currentLabels: readonly string[]; |
| 11194 | }): boolean { |
| 11195 | if (options.currentLabels.length >= 100) { |
| 11196 | console.warn( |
| 11197 | `Skipping optional label sync for ${options.label}: item ${options.number} already has 100 labels`, |
| 11198 | ); |
| 11199 | return false; |
| 11200 | } |
| 11201 | try { |
| 11202 | ghWithRetry(["issue", "edit", String(options.number), "--add-label", options.label]); |
| 11203 | return true; |
| 11204 | } catch (error) { |
| 11205 | if (!missingLabelError(error, options.label) && !labelCapacityError(error)) throw error; |
| 11206 | console.warn( |
| 11207 | `Skipping optional label sync for ${options.label}: ${ |
| 11208 | error instanceof Error ? error.message : String(error) |
| 11209 | }`, |
| 11210 | ); |
| 11211 | return false; |
| 11212 | } |
| 11213 | } |
| 11214 | |
| 11215 | export function isMissingGitHubLabelErrorForTest(message: string, label: string): boolean { |
| 11216 | return missingLabelError(new Error(message), label); |
no test coverage detected