Skip to content

Commit

Permalink
Create file if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisamiga committed Dec 16, 2023
1 parent 80e5536 commit e5e9aa0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function wasPostPublished(feed) {
lastPostContent = fs.readFileSync(lastPost, "utf8");
} catch (e) {
console.log("No .lastPost.txt file found");
// Create file if it doesn't exist
fs.writeFileSync(lastPost, "");
}
// If the post has been posted, skip
if (lastPostContent === feed.items[0].link) {
Expand Down

0 comments on commit e5e9aa0

Please sign in to comment.