File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,24 @@ export interface GitHubContributor {
66 contributions : number
77}
88
9+ // TODO: stub - need to fetch list of role members from somewhere to avoid hardcoding (
10+ type Role = 'stewards' | 'core' | 'maintainers'
11+ const roleMembers : Record < Role , GitHubContributor [ 'login' ] [ ] > = {
12+ stewards : [ 'danielroe' , 'patak-dev' ] ,
13+ core : [ ] ,
14+ maintainers : [ ] ,
15+ }
16+
17+ function getRoleOrder ( login : GitHubContributor [ 'login' ] ) {
18+ return roleMembers . stewards . includes ( login )
19+ ? 0
20+ : roleMembers . core . includes ( login )
21+ ? 1
22+ : roleMembers . maintainers . includes ( login )
23+ ? 2
24+ : 3
25+ }
26+
927export default defineCachedEventHandler (
1028 async ( ) : Promise < GitHubContributor [ ] > => {
1129 const allContributors : GitHubContributor [ ] = [ ]
@@ -46,8 +64,14 @@ export default defineCachedEventHandler(
4664 page ++
4765 }
4866
49- // Filter out bots
50- return allContributors . filter ( c => ! c . login . includes ( '[bot]' ) )
67+ return (
68+ allContributors
69+ // Filter out bots
70+ . filter ( c => ! c . login . includes ( '[bot]' ) )
71+
72+ // Sort by role (steward > core > maintainer > contributor)
73+ . sort ( ( a , b ) => getRoleOrder ( a . login ) - getRoleOrder ( b . login ) )
74+ )
5175 } ,
5276 {
5377 maxAge : 3600 , // Cache for 1 hour
You can’t perform that action at this time.
0 commit comments