投稿時間:2023-04-23 13:03:50 RSSフィード2023-04-23 13:00 分まとめ(6件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Linux Ubuntuタグが付けられた新着投稿 - Qiita Wine で ShellExecuteEx が失敗 https://qiita.com/nanbuwks/items/1a44640c3491d6bf7d4b winekindleforpcinstaller 2023-04-23 12:40:20
GCP gcpタグが付けられた新着投稿 - Qiita 企業の技術力を可視化できるデータを集めてみた(GCP編) https://qiita.com/sakaki_developer/items/77db658e5dfded9ab387 思いのほか 2023-04-23 12:41:52
海外TECH DEV Community How I Made a Reminder to Write a Blog Post Using GitHub Action https://dev.to/imamdev_/how-i-made-a-reminder-to-write-a-blog-post-using-github-action-3n88 How I Made a Reminder to Write a Blog Post Using GitHub ActionAs a writer I understand the importance of consistency when it comes to publishing new content However there are times when life gets in the way and it can be challenging to remember to write a new blog post To help me stay on track with my sharing schedule I created a simple reminder using GitHub Actions In this post I will share how I made this workflow What is GitHub Action GitHub Actions is a powerful tool that allows you to automate your workflows You can use it to build test and deploy your code You can also use it to perform a wide range of other tasks such as sending notifications or scheduling reminders How I Created a Reminder to Write a Blog PostTo create a reminder to write a blog post I m using GitHub special repository of README md and added a file named github workflows blog posts yml In this file I defined the workflow that GitHub Actions would execute Here s the initial content of the file name Blog Postson schedule cron Run at every Sunday workflow dispatch jobs update posts runs on ubuntu latest steps uses actions checkout v name Update post list run sleep m curl LO node src list posts js rm feed xml name Commit changes run git config local user email github actions bot users noreply github com git config local user name github actions bot git add A git diff index quiet HEAD git commit m Update blog posts name Pull changes run git pull r name Push changes uses ad m github push action fafddbdeccbdcacfceece with github token secrets GITHUB TOKEN This workflow is triggered every Sunday at It then runs a script that updates the list of blog posts The script is written in JavaScript and parses the RSS feed of my blog It then generates a list of blog posts and updates the README md file Finally it commits the changes and pushes them to GitHub I m using ouuan s repository as a reference for this workflow Where is the reminder came from It s actually in the list posts js file I added a reminder to the list of blog posts Here s the content of the file const readFileSync writeFileSync require fs Convert XML string to JSON param string xmlString returns object json const xmlToJson xmlString gt const regex lt w gt gt s S lt gt gm const matches xmlString matchAll regex const json for const match of matches const key attributes value match const subMatches value matchAll regex const subJson for const subMatch of subMatches const subKey subAttributes subValue subMatch if subValue match regex if Array isArray subJson subKey subJson subKey push xmlToJson lt subKey subAttributes gt subValue lt subKey gt subKey else if subJson subKey subJson subKey subJson subKey xmlToJson lt subKey subAttributes gt subValue lt subKey gt subKey else subJson subKey xmlToJson lt subKey subAttributes gt subValue lt subKey gt subKey else if Array isArray subJson subKey subJson subKey push subValue else if subJson subKey subJson subKey subJson subKey subValue else subJson subKey subValue if json key if Array isArray json key json key push subJson else json key json key subJson else json key subJson return json Sort JSON by pubDate param object json returns object sortedJson const sortJson json gt json sort a b gt new Date b pubDate new Date a pubDate return json Read XML file and convert to JSONconst xmlString readFileSync feed xml utf const feeds sortJson xmlToJson xmlString rss channel item Create Markdown list of postsconst posts feeds slice map item gt new Date item pubDate toISOString split T item title item link utm source GitHubProfile Update README md if posts have changed Otherwise throw an error to remind me to write a blog postconst readme readFileSync README md utf if readme includes posts join n throw new Error No new blog posts else const updatedReadme readFileSync README md utf replace lt lt START SECTION blog posts gt n s S n lt END SECTION blog posts gt posts join n writeFileSync README md updatedReadme console log Updated README md The script reads the RSS feed of my blog and generates a list of blog posts It then updates the README md file with the list of blog posts If there are no new blog posts it throws an error to remind me to write a blog post It s just an error that will be thrown when the script is executed while the posts are still the same and it s not a reminder that will be sent to my email or something more visible to me So I decided to enable the notification for any failed workflow runs Here s how to do it Click on the top right corner of the page and select Settings Select Notifications on the left sidebar Click on Actions Select Send notifications for failed workflows only Now I will get a notification when the script is executed and there are no new blog posts I can also see the notification on the GitHub website Another Way That I ExploredThe previous workflow that I tell you about is a modified version so my README md is always up to date I also explored another way to create a reminder to write a blog post But it s a pure reminder without any README md update mechanism just a reminder To create a reminder to write a blog post I created a new GitHub repository and added a file named github workflows remind yml In this file I defined the workflow that GitHub Actions would execute Here s the content of the file name Reminder to write a blog poston schedule cron jobs remind runs on ubuntu latest steps name Send a reminder uses dawidd action send mail v with server address smtp gmail com server port username secrets EMAIL USERNAME password secrets EMAIL PASSWORD subject Reminder to write a new blog post body Don t forget to write a new blog post today to my email example comThis workflow sends me an email reminder every weekday at AM reminding me to write a new blog post I used a third party action dawidd action send mail to send the email I provided my email credentials as GitHub secrets so they are not visible in the workflow file ConclusionI have explored two ways to create a reminder to write a blog post The first way is to update the README md file of my GitHub profile The second way is to send an email reminder I m currently using the first way because it s more visible than the second way I can see the reminder every time I visit my GitHub profile Creating a reminder to write a blog post using GitHub Actions is a simple and effective way to stay on track with your blogging schedule With this workflow in place you ll never forget to write a new post again If you re interested in creating your reminder workflow be sure to check out the GitHub Actions documentation to learn more Happy blogging 2023-04-23 03:21:03
ニュース BBC News - Home Sudan fighting: US military evacuates diplomats from Khartoum https://www.bbc.co.uk/news/world-africa-65363586?at_medium=RSS&at_campaign=KARANGA biden 2023-04-23 03:36:21
ニュース BBC News - Home The Papers: 'Activists target Suella' and 'Goodnight Possums' https://www.bbc.co.uk/news/blogs-the-papers-65363451?at_medium=RSS&at_campaign=KARANGA The Papers x Activists target Suella x and x Goodnight Possums x The home secretary s plan to target illegal migration and tributes for entertainer Barry Humphries lead Sunday s papers 2023-04-23 03:30:19
ビジネス プレジデントオンライン 獺祭・桜井博志会長72歳がアメリカに乗り込み、NY蔵を建てて"打倒獺祭"に挑むワケ - シニアこそ大胆に挑戦し、失敗する姿を若者に見せよう https://president.jp/articles/-/68567 桜井博志 2023-04-23 12:01:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)