@@ -22,6 +22,7 @@ async function HandleMultipleIssues() {
2222
2323 // Retrieve custom inputs
2424 const labels = core . getInput ( "label" ) . split ( "," ) . map ( label => label . trim ( ) ) ;
25+ const assign = core . getInput ( "assign" ) === "true" || false ;
2526 const issueNumber = core . getInput ( "issueNumber" ) === "true" || false ; // converts to boolean
2627 const comment = core . getInput ( "comment" ) ;
2728 const close = core . getInput ( "close" ) === "true" || false ;
@@ -40,14 +41,24 @@ async function HandleMultipleIssues() {
4041 state : "open" ,
4142 } ) ;
4243
43- if ( authorIssues . length === 0 ) {
44- core . notice ( "No existing open issues for this author." ) ;
45- return ; // No need to continue.
46- }
44+ const filteredIssues = assign
45+ ? authorIssues . filter ( ( issue : any ) =>
46+ issue . assignees . some ( ( assignee : any ) => assignee . login === author )
47+ )
48+ : authorIssues
49+
50+ if ( filteredIssues . length === 0 ) {
51+ core . notice (
52+ `No existing ${
53+ assign === true ? "issues created by and assigned to" : "open issues for"
54+ } this author.`
55+ )
56+ return // No need to continue.
57+ }
4758
4859 core . notice ( "step 3." ) ;
4960
50- const previousIssueNumbers = authorIssues
61+ const previousIssueNumbers = filteredIssues
5162 . filter ( ( issue : { number : any } ) => issue . number !== context . issue . number ) // Exclude the current issue
5263 . map ( ( issue : { number : any } ) => issue . number ) ;
5364
@@ -87,7 +98,9 @@ async function HandleMultipleIssues() {
8798
8899 if ( ! checkComment ) {
89100 // Condition 1: issueNumber is true, comment is false
90- commentText = `${ issueLinks } is already opened by you.` ;
101+
102+ if ( assign ) commentText = `${ issueLinks } has been opened by you and is also assigned to you.` ;
103+ else commentText = `${ issueLinks } is already opened by you.` ;
91104 } else if ( checkComment ) {
92105 // Condition 2: issueNumber is true, comment is true
93106 commentText = `${ issueLinks } ${ comment } ` ;
@@ -132,4 +145,4 @@ async function HandleMultipleIssues() {
132145 }
133146}
134147
135- HandleMultipleIssues ( ) ;
148+ HandleMultipleIssues ( ) ;
0 commit comments