diff --git a/.github/ISSUE_TEMPLATE/blank-issue-template.md b/.github/ISSUE_TEMPLATE/blank-issue-template.md index 95d8f2819b..e8ed8b5e0f 100644 --- a/.github/ISSUE_TEMPLATE/blank-issue-template.md +++ b/.github/ISSUE_TEMPLATE/blank-issue-template.md @@ -2,10 +2,13 @@ name: Blank Issue Template about: 'Standard HackforLA issue template ' title: '' -labels: 'Complexity: Missing, Feature Missing, role missing, size: missing' +labels: 'Template Label Placeholder' assignees: '' --- + + + ### Overview REPLACE THIS TEXT - Clearly state the purpose of this issue in 2 sentences or less. We write ours a modified user story in this format: _We need to do X for Y reason._ 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 5aa85adbfa..05f4da7061 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 @@ -1,4 +1,5 @@ // Module imports +const retrieveLabelDirectory = require('../../utils/retrieve-label-directory'); const statusFieldIds = require('../../utils/_data/status-field-ids'); const queryIssueInfo = require('../../utils/query-issue-info'); const mutateIssueStatus = require('../../utils/mutate-issue-status'); @@ -8,9 +9,6 @@ const REQUIRED_LABELS = ['Complexity', 'role', 'Feature', 'size']; const LABEL_MISSING = ['Complexity: Missing', 'role missing', 'Feature Missing', 'size: missing']; const COMPLEXITY_EXCEPTIONS = ['good first issue']; -// SPECIAL_CASE is for issue created by reference with issue title "Hack for LA website bot" (from "Review Inactive Team Members") -const SPECIAL_CASE = ['ready for dev lead','Feature: Administrative','size: 0.25pt','Complexity: Small','role: dev leads']; - // Global variables var github; var context; @@ -26,14 +24,22 @@ async function main({ g, c }) { context = c; const issueNum = context.payload.issue.number; const issueTitle = context.payload.issue.title; + const templateTrigger = context.payload.issue.labels[0].name; + let labels = []; - const labels = obtainLabels(); + // If the issue is a template, extract the labelKeys then convert to labels + if (templateTrigger === 'Template Label Placeholder') { + labels = extractTemplateLabels(); + } else { + labels = obtainLabels(); + } + const filteredLabels = filterLabels(labels); let labelsToAdd = checkLabels(filteredLabels); - // Labels for SPECIAL_CASE noted above, change issue status to "Questions / In Review" + // SPECIAL_CASE: If issue has title "Hack for LA website bot" (from "Review + // Inactive Team Members") then change issue status to "Questions / In Review" if (issueTitle.includes('Hack for LA website bot')) { - labelsToAdd = SPECIAL_CASE; // Find GraphQL issue id and change status id, then change status const { id: itemId } = await queryIssueInfo(github, context, issueNum); const newStatusValue = statusFieldIds("Questions_In_Review"); @@ -54,6 +60,22 @@ async function main({ g, c }) { }; } +/** + * Only for template: extract all labels from the template body + * @return {Array} - returns an array of all the labels + */ +function extractTemplateLabels() { + const templateBody = context.payload.issue.body; + // Extract label list from a comment in the template body + const match = templateBody.match(//); + if (!match) return []; + + // Extract each labelKey, convert to labelName, and return as an array + let labelKeys = match[1].split(',').map(label => label.trim()); + let labelNames = labelKeys.map(labelKey => retrieveLabelDirectory(labelKey)); + return labelNames +} + /** * Get all labels from the issue * @return {Array} - returns an array of all the labels diff --git a/github-actions/trigger-schedule/list-inactive-members/inactive-members.md b/github-actions/trigger-schedule/list-inactive-members/inactive-members.md index 02efe8f359..34070b037c 100644 --- a/github-actions/trigger-schedule/list-inactive-members/inactive-members.md +++ b/github-actions/trigger-schedule/list-inactive-members/inactive-members.md @@ -2,14 +2,14 @@ name: Review Inactive Team Members about: Issue template used only by `schedule-monthly.yml` title: "Review Inactive Team Members" -labels: ['Feature: Administrative', 'Feature: Onboarding/Contributing.md', 'role: dev leads', 'Complexity: Small', 'size: 0.5pt'] +labels: 'Template Label Placeholder' milestone: 8 assignees: '' --- - - + + + + # Review of Inactive Website Team Members ## Inactive Members