Handling missing card titles.
This commit is contained in:
parent
dd36ee1aba
commit
02cd395ff5
|
@ -31,6 +31,12 @@ async function getWekanActorNames() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const actorNames = wekanBoardRes.body.map((card) => {
|
const actorNames = wekanBoardRes.body.map((card) => {
|
||||||
|
if (!card.title) {
|
||||||
|
console.warn('Missing card title', card);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const name = card.title.split(/\s+/).slice(0, 2).join(' ');
|
const name = card.title.split(/\s+/).slice(0, 2).join(' ');
|
||||||
|
|
||||||
if (name.includes('.')) {
|
if (name.includes('.')) {
|
||||||
|
@ -41,7 +47,7 @@ async function getWekanActorNames() {
|
||||||
return name;
|
return name;
|
||||||
;});
|
;});
|
||||||
|
|
||||||
return actorNames;
|
return actorNames.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
@ -52,7 +58,7 @@ async function init() {
|
||||||
const actorLineIndex = automodLines.findIndex((line) => line.includes(config.actorCommentKey)) + 1;
|
const actorLineIndex = automodLines.findIndex((line) => line.includes(config.actorCommentKey)) + 1;
|
||||||
const actorLine = automodLines[actorLineIndex];
|
const actorLine = automodLines[actorLineIndex];
|
||||||
|
|
||||||
const wekanActorNames= await getWekanActorNames();
|
const wekanActorNames = await getWekanActorNames();
|
||||||
const actorNames = [...config.baseActorNames, ...wekanActorNames];
|
const actorNames = [...config.baseActorNames, ...wekanActorNames];
|
||||||
const newActorLine = `title: ${JSON.stringify(actorNames)}`;
|
const newActorLine = `title: ${JSON.stringify(actorNames)}`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue