Skip to content

Commit

Permalink
simplifying
Browse files Browse the repository at this point in the history
  • Loading branch information
t-will-gillis committed Nov 4, 2024
1 parent 3fc6a68 commit 6484170
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Mobile_responsiveness.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,28 @@ 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();
labels = labelKeys.map(labelKey => retrieveLabelDirectory(labelKey));
} 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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6484170

Please sign in to comment.