@@ -6,10 +6,24 @@ const { Toolkit } = require("actions-toolkit");
6
6
7
7
const MAX_LINES = 5 ;
8
8
9
+ /**
10
+ * Returns the sentence case representation
11
+ * @param {String } str - the string
12
+ *
13
+ * @returns {String }
14
+ */
15
+
9
16
const capitalize = ( str ) => str . slice ( 0 , 1 ) . toUpperCase ( ) + str . slice ( 1 ) ;
10
17
11
18
const urlPrefix = "https://github.com/" ;
12
19
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
+
13
27
const toUrlFormat = ( item ) => {
14
28
if ( typeof item === "object" ) {
15
29
return Object . hasOwnProperty . call ( item . payload , "issue" )
@@ -19,6 +33,14 @@ const toUrlFormat = (item) => {
19
33
return `[${ item } ](${ urlPrefix } /${ item } )` ;
20
34
} ;
21
35
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
+
22
44
const exec = ( cmd , args = [ ] ) =>
23
45
new Promise ( ( resolve , reject ) => {
24
46
const app = spawn ( cmd , args , { stdio : "inherit" } ) ;
@@ -33,6 +55,12 @@ const exec = (cmd, args = []) =>
33
55
app . on ( "error" , reject ) ;
34
56
} ) ;
35
57
58
+ /**
59
+ * Make a commit
60
+ *
61
+ * @returns {Promise<void> }
62
+ */
63
+
36
64
const commitFile = async ( ) => {
37
65
await exec ( "git" , [
38
66
"config" ,
@@ -129,6 +157,7 @@ Toolkit.run(
129
157
130
158
startIdx ++ ;
131
159
160
+ // it is likely that a newline is inserted after the <!--START_SECTION:activity--> comment (code formatter)
132
161
let count = 0 ;
133
162
readmeContent . slice ( startIdx , endIdx ) . forEach ( ( line , idx ) => {
134
163
if ( line !== "" ) {
0 commit comments