diff --git a/src/main.ts b/src/main.ts index b555bbe..17d1ecd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -240,14 +240,23 @@ async function addLabels(prNumber: number, labels: Label[]): Promise { const remoteLabel = existingLabels.find( label_ => label.name === label_.name ) - if (!remoteLabel && label.name) { - const response = await octokit.issues.createLabel({ - owner, - repo, - name: label.name, - color: label.color - }) - core.info(JSON.stringify(response)) + if (!remoteLabel) { + core.info( + `Creating label ${label.name} (not found in ${JSON.stringify( + existingLabels + )}` + ) + try { + const response = await octokit.issues.createLabel({ + owner, + repo, + name: label.name, + color: label.color + }) + core.info(JSON.stringify(response)) + } catch (e) { + core.warning(`Creation failed: ${e.message}`) + } } }