Skip to content

Commit 4a395dc

Browse files
chore: annotate methods in accordance with JSDoc conventions
1 parent 66c87c7 commit 4a395dc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,24 @@ const { Toolkit } = require("actions-toolkit");
66

77
const MAX_LINES = 5;
88

9+
/**
10+
* Returns the sentence case representation
11+
* @param {String} str - the string
12+
*
13+
* @returns {String}
14+
*/
15+
916
const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);
1017

1118
const 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+
1327
const 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+
2244
const 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+
3664
const 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

Comments
 (0)