Skip to content

Commit

Permalink
Add "issue_label" in configuratioin for better issue sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-github committed Nov 20, 2024
1 parent 50c645a commit 4ec98d1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 163 deletions.
148 changes: 0 additions & 148 deletions config/portfolio_config copy.json

This file was deleted.

42 changes: 28 additions & 14 deletions config/portfolio_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
{
"name": "2.1.x",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "ESP-2.X"
},
{
"name": "3.0",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "ESP-3.X"
}
]
},
Expand All @@ -31,12 +33,14 @@
{
"name": "master",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
},
{
"name": "3.0",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "3.0"
}
]
},
Expand All @@ -56,7 +60,8 @@
{
"name": "3.0",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "3.0"
}
]
},
Expand All @@ -71,7 +76,8 @@
{
"name": "main",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "1.0"
}
]
},
Expand All @@ -86,12 +92,14 @@
{
"name": "ESP3DLib-V3-bugfix-2.1.x",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "Bugfix-2.1.X"
},
{
"name": "ESP3DLib-V3-2.1.2",
"label": "Development",
"is_production": false
"is_production": false,
"issue_label": "2.1.X"
}
]
},
Expand All @@ -106,7 +114,8 @@
{
"name": "main",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
}
]
},
Expand All @@ -121,7 +130,8 @@
{
"name": "main",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
}
]
},
Expand All @@ -136,7 +146,8 @@
{
"name": "v2.x",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "2.0"
}
]
},
Expand All @@ -151,7 +162,8 @@
{
"name": "main",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
}
]
},
Expand All @@ -166,7 +178,8 @@
{
"name": "main",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
}
]
},
Expand All @@ -181,7 +194,8 @@
{
"name": "main",
"label": "Production",
"is_production": true
"is_production": true,
"issue_label": "1.0"
}
]
}
Expand Down
23 changes: 22 additions & 1 deletion src/collectors/github_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,28 @@ def _collect_branch_issues(self, repo, branch_config) -> List[Dict]:
# Skip issues with ignored labels
if any(label.name in branch_config.ignore_labels for label in issue.labels):
continue

# Récupérer les labels de l'issue
issue_labels = [label.name for label in issue.labels]

# Si la branche a un issue_label configuré
if branch_config.issue_label:
# Vérifier si l'issue a un label de version (de n'importe quelle branche)
all_version_labels = {b.issue_label for b in repo.branches
if b.issue_label is not None}
has_version_label = any(label in all_version_labels for label in issue_labels)

# Ignorer l'issue si elle a un label de version différent de celui de la branche
if has_version_label and branch_config.issue_label not in issue_labels:
continue
# Si la branche n'a pas d'issue_label configuré
else:
# Si l'issue a un label de version, l'ignorer pour cette branche
other_branch_labels = {b.issue_label for b in repo.branches
if b.issue_label is not None}
if any(label in other_branch_labels for label in issue_labels):
continue

issue_data = {
'number': issue.number,
'title': issue.title,
Expand All @@ -128,7 +149,7 @@ def _collect_branch_issues(self, repo, branch_config) -> List[Dict]:
'closed_at': issue.closed_at.isoformat() if issue.closed_at else None,
'url': issue.html_url,
'is_pr': bool(issue.pull_request),
'labels': [label.name for label in issue.labels],
'labels': issue_labels,
'priority': self._determine_issue_priority(issue, branch_config),
'assignee': issue.assignee.login if issue.assignee else None
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class BranchConfig:
name: str
label: str
is_production: bool
issue_label: str = None
ignore_labels: list = None
tracked_labels: list = None
highlight_labels: list = None
Expand Down

0 comments on commit 4ec98d1

Please sign in to comment.