@@ -6,10 +6,24 @@ const { Toolkit } = require("actions-toolkit");
66
77const MAX_LINES = 5 ;
88
9+ /**
10+ * Returns the sentence case representation
11+ * @param {String } str - the string
12+ *
13+ * @returns {String }
14+ */
15+
916const capitalize = ( str ) => str . slice ( 0 , 1 ) . toUpperCase ( ) + str . slice ( 1 ) ;
1017
1118const urlPrefix = "https://github.com/" ;
1219
20+ /**
21+ * Returns a URL in markdown format for PR's and issues
22+ * @param {Object | String } item - holds information concerning the issue/PR
23+ *
24+ * @returns {String }
25+ */
26+
1327const toUrlFormat = ( item ) => {
1428 if ( typeof item === "object" ) {
1529 return Object . hasOwnProperty . call ( item . payload , "issue" )
@@ -19,6 +33,14 @@ const toUrlFormat = (item) => {
1933 return `[${ item } ](${ urlPrefix } /${ item } )` ;
2034} ;
2135
36+ /**
37+ * Execute shell command
38+ * @param {String } cmd - root command
39+ * @param {String[] } args - args to be passed alongwith
40+ *
41+ * @returns {Promise<void> }
42+ */
43+
2244const exec = ( cmd , args = [ ] ) =>
2345 new Promise ( ( resolve , reject ) => {
2446 const app = spawn ( cmd , args , { stdio : "inherit" } ) ;
@@ -33,6 +55,12 @@ const exec = (cmd, args = []) =>
3355 app . on ( "error" , reject ) ;
3456 } ) ;
3557
58+ /**
59+ * Make a commit
60+ *
61+ * @returns {Promise<void> }
62+ */
63+
3664const commitFile = async ( ) => {
3765 await exec ( "git" , [
3866 "config" ,
@@ -129,6 +157,7 @@ Toolkit.run(
129157
130158 startIdx ++ ;
131159
160+ // it is likely that a newline is inserted after the <!--START_SECTION:activity--> comment (code formatter)
132161 let count = 0 ;
133162 readmeContent . slice ( startIdx , endIdx ) . forEach ( ( line , idx ) => {
134163 if ( line !== "" ) {
0 commit comments