New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Word Count Log File GitHub Action #22
feat: Word Count Log File GitHub Action #22
Conversation
- add package.json to be able to use external dependencies - add glob and reading-time for calculating word count - add wordCount.js for iterating over all markdown files and displaying diff changes between each file edit - add node_modules to .gitignore - add logfile.json example Signed-off-by: mhatvan <markus_hatvan@aon.at>
You are the man! I'm not able to run locally for some reason. Getting the following error: BKSQ-XL0J-MAC:content conderj$ node wordCount.js /Users/conderj/content/wordCount.js:48 const wordCountExisting = currentWords ?? existingFileName.initialWords; SyntaxError: Unexpected token '?' at wrapSafe (internal/modules/cjs/loader.js:1053:16) at Module._compile (internal/modules/cjs/loader.js:1101:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 |
I can still merge the pull request if it helps you debug/move forward. As long as it works in the action, I can always figure out what's wrong on local later. |
Sorry, my bad. The No need for merging yet, I will work on the action file next. |
- updated GitHub actions.yml Signed-off-by: mhatvan <markus_hatvan@aon.at>
- change rewriting logfile with JSON.stringify to keep formatting Signed-off-by: mhatvan <markus_hatvan@aon.at>
…tvan/Content into 21-word-count-log-file-github-action
- remove paragraph in testfile.md to inspect changes on diff - change npm i to npm ci for faster install with frozen lockfile Signed-off-by: mhatvan <markus_hatvan@aon.at>
Signed-off-by: mhatvan <markus_hatvan@aon.at>
I have good news! I updated the GitHub action file and it works perfectly:
You can go through the commit history of this PR to see what exactly is happening. If you ever need GitHub actions more often, you can use this helpful library to run them locally: https://github.com/nektos/act Currently, the GitHub action is triggered on a push in any branch. I can specify this to be master only. When you decide this is the way you want it, I would:
And BIG thanks for your GitHub Sponsors support!! 🎉 |
THIS is a thing of beauty! I love the way you record the log as a json file too. Opens the door to build a dashboard using Netlify. Thank you so much for the time you spent on this. We have a lot of similar interests (jamstack, svelte, IF, EDM, crypto, etc) so I'm honored to be your first sponsor. |
I am glad you like it! Haha, cool that you are also interested in all of these things 😄 |
Phew, this was quite a lot of work, but fun!
I hope the implementation is how you would imagine it ;)
The
logfile.json
displays all blog posts with initial wordsAs soon as there is a diff because of rewriting files, you can see a ISO timestamp with the diff to the previous number of words and now current words.
To try it out locally:
logfile.json
, just leave it an empty objectnode wordCount.js
logfile.json
node wordCount.js
I will implement the GitHub action when you say this is how you want it! Should just be a matter of running
node wordCount.js
ongit push
.Closes #21.
IssueHunt Summary
Referenced issues
This pull request has been submitted to: