From 64841700a9931f0843f7acda099064a9e7b4b2f7 Mon Sep 17 00:00:00 2001 From: t-will-gillis <40799239+t-will-gillis@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:35:42 -0800 Subject: [PATCH] simplifying --- .../ISSUE_TEMPLATE/Mobile_responsiveness.yml | 2 +- .../correct-misspelling-on-website-page.md | 3 +-- .../check-labels.js | 25 ++++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Mobile_responsiveness.yml b/.github/ISSUE_TEMPLATE/Mobile_responsiveness.yml index 2af7c879c3..115731550d 100644 --- a/.github/ISSUE_TEMPLATE/Mobile_responsiveness.yml +++ b/.github/ISSUE_TEMPLATE/Mobile_responsiveness.yml @@ -1,7 +1,7 @@ name: 'Responsiveness on mobile ' description: 'Standard HackforLA issue template ' title: 'Mobile Responsiveness on [name of the page] : [quick recap of the bug here]' -labels: ['role: design', 'Feature Missing', 'Complexity: Missing', 'size: missing'] +labels: 'Template Label', 'roleDesign', 'featureMissing', 'complexityMissing', 'sizeMissing' # assignees: body: diff --git a/.github/ISSUE_TEMPLATE/correct-misspelling-on-website-page.md b/.github/ISSUE_TEMPLATE/correct-misspelling-on-website-page.md index 7e0edb47a1..8b5b05cea3 100644 --- a/.github/ISSUE_TEMPLATE/correct-misspelling-on-website-page.md +++ b/.github/ISSUE_TEMPLATE/correct-misspelling-on-website-page.md @@ -2,8 +2,7 @@ name: Correct misspelling on Website Page about: Describe this issue template's purpose here. title: Correct misspelling in [REPLACE WITH NAME OF PAGE] page -labels: 'Feature Missing, feature: spelling, good first issue, role: back end/devOps, - role: front end, size: 0.25pt, time sensitive' +labels: 'Template Label, featureMissing, featureSpelling, complexity1, roleBackEndDevOps, roleFrontEnd, size025pt, timeSensitive' assignees: '' --- diff --git a/github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js b/github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js index d4ec219d35..4cfd9db864 100644 --- a/github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js +++ b/github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js @@ -26,7 +26,7 @@ async function main({ g, c }) { const issueTitle = context.payload.issue.title; const templateTrigger = context.payload.issue.labels[0].name; let labels = [] - +/* // If the issue is a template, extract the labelKeys then convert to labels if (templateTrigger === 'Template Label') { let labelKeys = extractTemplateLabels(); @@ -34,12 +34,20 @@ async function main({ g, c }) { } else { labels = obtainLabels(); } - +*/ + + // If the issue is a template, extract the labelKeys then convert to labels + if (templateTrigger === 'Template Label') { + labels = obtainLabelKeys(); + } else { + labels = obtainLabels(); + } + const filteredLabels = filterLabels(labels); let labelsToAdd = checkLabels(filteredLabels); // SPECIAL_CASE: If issue has title "Hack for LA website bot" (from "Review - // Inactive Team Members") then change issue status to "Questions / In Review" + // Team Members") then change issue status to "Questions / In Review" if (issueTitle.includes('Hack for LA website bot')) { // Find GraphQL issue id and change status id, then change status const { id: itemId } = await queryIssueInfo(github, context, issueNum); @@ -84,6 +92,17 @@ function obtainLabels() { return labels; } +/** + * Get all labels from the issue + * @return {Array} - returns an array of all the labels + */ +function obtainLabelKeys() { + const labelsObject = context.payload.issue.labels; + const labelKeys = labelsObject.map(label => label.name); + labels = labelKeys.map(labelKey => retrieveLabelDirectory(labelKey)); + return labels; +} + /** * Ensure that the issue was not created with labels from LABEL_MISSING array * If so, they will be filtered and dealt with under the addLabels function