Skip to content

Commit 36518e6

Browse files
Add blog post workflow to update README
1 parent 34cdd0c commit 36518e6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Latest blog post workflow
2+
3+
on:
4+
schedule:
5+
- cron: '0 * * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-readme-with-blog:
10+
name: Update this repo's README with latest blog posts
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Pull in medium posts
17+
uses: gautamkrishnar/blog-post-workflow@v1
18+
with:
19+
feed_list: "https://medium.com/feed/@vishalgunjal"
20+
max_post_count: 5
21+
22+
# 👇 JAVASCRIPT LOGIC TO FORCE THE DATE FORMAT
23+
item_exec: |
24+
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
25+
const d = new Date(post.pubDate);
26+
post.my_custom_date = `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
27+
28+
# 👇 USE THE CUSTOM VARIABLE WE JUST MADE ($my_custom_date)
29+
template: "$newline- 📝 [$title]($url) — $my_custom_date"
30+
31+
commit_message: "docs: update readme with forced date script"

0 commit comments

Comments
 (0)