File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ My name is Pulkit. I'm a undergraduate from 🇮🇳
2828
2929---
3030
31- ### :sparkles : [ My followers] ( https://github.com/Pulkitxm?tab=followers )
31+ <!-- START_SECTION:top-followers-heading-->
32+ ### :sparkles : [ My followers (58)] ( https://github.com/Pulkitxm?tab=followers )
33+ <!-- End_SECTION:top-followers-heading-->
3234
3335<!-- START_SECTION:top-followers-->
3436<div style =" display : flex ; justify-content : center ; flex-wrap : wrap ;" ><a href =" https://github.com/trinhminhtriet " target =" _blank " ><img src =" https://avatars.githubusercontent.com/u/1650997?v=4 " alt =" Follower " width =" 50 " height =" 50 " style =" border-radius : 50% ; margin : 3px ;" /></a >
Original file line number Diff line number Diff line change 11import dotenv from "dotenv" ;
22dotenv . config ( ) ;
33
4- console . log ( process . env . ACCESS_TOKEN ) ;
4+ if ( process . env . ACCESS_TOKEN === undefined ) {
5+ console . error ( "Please provide ACCESS_TOKEN in .env file" ) ;
6+ process . exit ( 1 ) ;
7+ }
58
69import { Octokit } from "@octokit/rest" ;
710import { readFileSync , writeFileSync } from "fs" ;
@@ -34,8 +37,14 @@ const getLatestFollowers = async () => {
3437
3538async function main ( ) {
3639 const followers = await getLatestFollowers ( ) ;
37-
40+ const followersLength = followers . length ;
3841 let readme = readFileSync ( READMEFILE_PATH , "utf-8" ) ;
42+
43+ readme = readme . replace (
44+ / (?< = < ! - - S T A R T _ S E C T I O N : t o p - f o l l o w e r s - h e a d i n g - - > \n # # # : s p a r k l e s : \[ M y f o l l o w e r s \( ) ( \d + ) (? = \) \] ) / ,
45+ `${ followersLength } `
46+ ) ;
47+
3948 readme = readme . replace (
4049 / (?< = < ! - - S T A R T _ S E C T I O N : t o p - f o l l o w e r s - - > \n ) [ \s \S ] * (? = \n < ! - - E N D _ S E C T I O N : t o p - f o l l o w e r s - - > ) / ,
4150 `<div style="display: flex; justify-content: center; flex-wrap: wrap;">` +
@@ -47,6 +56,12 @@ async function main() {
4756 . join ( "\n" ) +
4857 `</div>`
4958 ) ;
59+
60+
61+
62+ // Update the followers count
63+
64+
5065 writeFileSync ( READMEFILE_PATH , readme ) ;
5166}
5267
You can’t perform that action at this time.
0 commit comments