@@ -8,7 +8,7 @@ import {Labeling} from '../../shared/labeling.js';
88export class IssueLabeling extends Labeling {
99 readonly type = 'Issue' ;
1010 /** Set of area labels available in the current repository. */
11- repoAreaLabels = new Set < string > ( ) ;
11+ repoAreaLabels = new Map < string , string > ( ) ;
1212 /** The issue data fetched from Github. */
1313 issueData ?: components [ 'schemas' ] [ 'issue' ] ;
1414
@@ -17,7 +17,7 @@ export class IssueLabeling extends Labeling {
1717
1818 // Determine if the issue already has an area label, if it does we can exit early.
1919 if (
20- this . issueData ?. labels . some ( ( label ) =>
20+ this . issueData ?. labels . some ( ( label : string | { name ?: string } ) =>
2121 ( typeof label === 'string' ? label : label . name ) ?. startsWith ( 'area: ' ) ,
2222 )
2323 ) {
@@ -37,10 +37,13 @@ ${this.issueData!.body}
3737
3838The available area labels are:
3939${ Array . from ( this . repoAreaLabels )
40- . map ( ( label ) => ` - ${ label } ` )
40+ . map (
41+ ( [ label , description ] ) =>
42+ ` - Label: ${ label } ${ description ? `, Description: ${ description } ` : '' } ` ,
43+ )
4144 . join ( '\n' ) }
4245
43- Based on the content, which area label is the best fit?
46+ Based on the content of the issue and the available labels , which area label is the best fit?
4447Respond ONLY with the exact label name (e.g. "area: core").
4548If you are strictly unsure or if multiple labels match equally well, respond with "ambiguous".
4649If no area label applies, respond with "none".
@@ -82,7 +85,7 @@ If no area label applies, respond with "none".
8285 . then ( ( labels ) =>
8386 labels
8487 . filter ( ( l ) => l . name . startsWith ( 'area: ' ) )
85- . forEach ( ( l ) => this . repoAreaLabels . add ( l . name ) ) ,
88+ . forEach ( ( l ) => this . repoAreaLabels . set ( l . name , l . description ?? '' ) ) ,
8689 ) ,
8790 this . git . issues . get ( { owner, repo, issue_number : context . issue . number } ) . then ( ( resp ) => {
8891 this . issueData = resp . data ;
0 commit comments