Skip to content

Commit

Permalink
Do not comment if file is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Nov 30, 2023
1 parent b4eda1a commit 59bd4ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9563,6 +9563,10 @@ async function run() {
let content = message;
if (!message && filePath) {
content = fs_1.default.readFileSync(filePath, 'utf8');
// exit if file is empty (and do not comment)
if (content.length === 0) {
return;
}
if (mdLanguage) {
content = `\`\`\`${mdLanguage}\n${content}\n\`\`\``;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ async function run() {
let content: string = message;
if (!message && filePath) {
content = fs.readFileSync(filePath, 'utf8');

// exit if file is empty (and do not comment)
if (content.length === 0) {
return;
}

if (mdLanguage) {
content = `\`\`\`${mdLanguage}\n${content}\n\`\`\``;
}
Expand Down

0 comments on commit 59bd4ab

Please sign in to comment.