@@ -478,19 +478,14 @@ ${changelog}`
478478 const token = process . env . GH_TOKEN
479479
480480 try {
481- const response = await axios . get (
482- `https://api.github.com/repos/${ owner } /${ repo } /contributors` ,
483- {
484- headers : { Authorization : `token ${ token } ` } ,
485- } ,
486- ) ;
481+ const response = await axios . get ( `https://api.github.com/repos/${ owner } /${ repo } /contributors` , {
482+ headers : { Authorization : `token ${ token } ` } ,
483+ } )
487484
488485 // Filter out bot accounts
489- const excludeUsers = [ 'dependabot[bot]' , 'actions-user' ] ;
486+ const excludeUsers = [ 'dependabot[bot]' , 'actions-user' ]
490487
491- const filteredContributors = response . data . filter (
492- ( contributor ) => ! excludeUsers . includes ( contributor . login ) ,
493- ) ;
488+ const filteredContributors = response . data . filter ( ( contributor ) => ! excludeUsers . includes ( contributor . login ) )
494489
495490 const contributors = filteredContributors . map ( ( contributor ) => {
496491 return `
@@ -499,45 +494,45 @@ ${changelog}`
499494 <img src="${ contributor . avatar_url } " width="100" height="100" alt="${ contributor . login } "/><br />
500495 <sub><b>${ contributor . login } </b></sub>
501496 </a>
502- </td>` ;
503- } ) ;
497+ </td>`
498+ } )
504499
505500 // Chunk contributors into rows of 4
506- const rows = [ ] ;
507- const chunkSize = 4 ;
501+ const rows = [ ]
502+ const chunkSize = 4
508503 for ( let i = 0 ; i < contributors . length ; i += chunkSize ) {
509- rows . push ( `<tr>${ contributors . slice ( i , i + chunkSize ) . join ( '' ) } </tr>` ) ;
504+ rows . push ( `<tr>${ contributors . slice ( i , i + chunkSize ) . join ( '' ) } </tr>` )
510505 }
511506
512507 // Combine rows into a table
513508 const contributorsTable = `
514509<table>
515510 ${ rows . join ( '\n' ) }
516511</table>
517- ` ;
512+ `
518513
519- const readmePath = path . join ( __dirname , 'README.md' ) ;
520- let content = fs . readFileSync ( readmePath , 'utf-8' ) ;
514+ const readmePath = path . join ( __dirname , 'README.md' )
515+ let content = fs . readFileSync ( readmePath , 'utf-8' )
521516
522517 // Replace or add the contributors section in the README
523- const contributorsSectionRegex = / ( # # C o n t r i b u t o r s \s * \n ) ( [ \s \S ] * ?) ( \n # # | $ ) / ;
524- const match = content . match ( contributorsSectionRegex ) ;
518+ const contributorsSectionRegex = / ( # # C o n t r i b u t o r s \s * \n ) ( [ \s \S ] * ?) ( \n # # | $ ) /
519+ const match = content . match ( contributorsSectionRegex )
525520
526521 if ( match ) {
527522 const updatedContent = content . replace (
528523 contributorsSectionRegex ,
529- `${ match [ 1 ] } \n${ contributorsTable } \n${ match [ 3 ] } `
530- ) ;
531- fs . writeFileSync ( readmePath , updatedContent , 'utf-8' ) ;
524+ `${ match [ 1 ] } \n${ contributorsTable } \n${ match [ 3 ] } ` ,
525+ )
526+ fs . writeFileSync ( readmePath , updatedContent , 'utf-8' )
532527 } else {
533528 // If no contributors section exists, add one at the end
534- content += `\n${ contributorsTable } ` ;
535- fs . writeFileSync ( readmePath , content , 'utf-8' ) ;
529+ content += `\n${ contributorsTable } `
530+ fs . writeFileSync ( readmePath , content , 'utf-8' )
536531 }
537532
538- console . log ( 'Contributors section updated successfully!' ) ;
533+ console . log ( 'Contributors section updated successfully!' )
539534 } catch ( error ) {
540- console . error ( 'Error fetching contributors:' , error . message ) ;
535+ console . error ( 'Error fetching contributors:' , error . message )
541536 }
542537 } ,
543538
0 commit comments