1616// under the License.
1717
1818async function have_comment ( github , context , pr_number , tag ) {
19+ console . log ( `Looking for existing comment on ${ pr_number } with substring ${ tag } ` ) ;
1920 const query = `
2021query($owner: String!, $name: String!, $number: Int!, $cursor: String) {
2122 repository(owner: $owner, name: $name) {
2223 pullRequest(number: $number) {
24+ id
2325 comments (after:$cursor, first: 50) {
2426 nodes {
2527 id
26- bodyText
28+ body
2729 author {
2830 login
2931 }
@@ -47,14 +49,15 @@ query($owner: String!, $name: String!, $number: Int!, $cursor: String) {
4749 number : pr_number ,
4850 cursor,
4951 } ) ;
50- console . log ( result ) ;
5152 pr_id = result . repository . pullRequest . id ;
5253 cursor = result . repository . pullRequest . comments . pageInfo ;
5354 const comments = result . repository . pullRequest . comments . nodes ;
5455
5556 for ( const comment of comments ) {
56- if ( comment . author . login === "github-actions[bot]" &&
57- comment . bodyText . match ( tag_regexp ) !== null ) {
57+ console . log ( comment ) ;
58+ if ( comment . author . login === "github-actions" &&
59+ comment . body . match ( tag_regexp ) !== null ) {
60+ console . log ( "Found existing comment" ) ;
5861 return { pr_id, comment_id : comment . id } ;
5962 }
6063 }
@@ -64,6 +67,7 @@ query($owner: String!, $name: String!, $number: Int!, $cursor: String) {
6467 break ;
6568 }
6669 }
70+ console . log ( "No existing comment" ) ;
6771 return { pr_id, comment_id : null } ;
6872}
6973
0 commit comments