Skip to content

Commit

Permalink
test get labels function
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Feb 4, 2022
1 parent d28eeae commit 4ba4b17
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async function getColumnCardIssues (columnId) {
}

// Get a list of labels for an issue
// @param {string} issueNumber The number of the issue to fetch labels for
// @param {number} issueNumber The number of the issue to fetch labels for
// @return {Promise} A promise representing fetching of the labels for an issue
// @fulfilled {Object} A list of objects each representing a label
// @throws {TypeError} for a parameter of the incorrect type
Expand Down Expand Up @@ -321,14 +321,25 @@ async function main () {
continue
}

const cardsLabeledCount = await labelCards(cards, column_labels['labels'])
for (const card of cards) {
const issueNumberMatchCapture = card.content_url.match(/\/issues\/(\d+)$/)

console.log(`Labeled/relabeled ${cardsLabeledCount} of ${cards.length} card issues`)
if (!issueNumberMatchCapture || issueNumberMatchCapture.length < 2) {
console.warn(`Failed to extract issue number from url: ${card.content_url}`)
continue
}

const issueNumber = issueNumberMatchCapture[1]
console.log(await getIssueLabels(issueNumber))
}
//const cardsLabeledCount = await labelCards(cards, column_labels['labels'])

//console.log(`Labeled/relabeled ${cardsLabeledCount} of ${cards.length} card issues`)
}

return

// Remove the label from the cards
/*// Remove the label from the cards
cards.data.forEach(async card => {
const matches = card.content_url.match(/\/issues\/(\d+)/);
Expand All @@ -350,7 +361,7 @@ async function main () {
console.log(e.message);
return true;
}
});
})*/
}

main().catch((e) => {
Expand Down

0 comments on commit 4ba4b17

Please sign in to comment.