惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
P
Privacy International News Feed
T
Tenable Blog
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
S
Securelist
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
月光博客
月光博客
T
The Blog of Author Tim Ferriss
Scott Helme
Scott Helme
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
Security Latest
Security Latest
Blog — PlanetScale
Blog — PlanetScale
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
博客园 - 三生石上(FineUI控件)
I
InfoQ
Spread Privacy
Spread Privacy
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
博客园_首页
Engineering at Meta
Engineering at Meta
Project Zero
Project Zero
Latest news
Latest news

方寸之間

修复 Arch Linux 的内核缺失问题 - 方寸之間 安装定制化 Vim - 方寸之間 树莓派配置旁路由过程记录 - 方寸之間 Cloudflare Tunnel 不完全上手指南 - 方寸之間 解除 New Bing 地区和浏览器限制的方法 - 方寸之間 FRP 上手教程 - 方寸之間 深入理解 Linux nohup 命令 - 方寸之間 C++智能指针是什么 - 方寸之間 PGP 工作原理详解 - 方寸之間 如何恢复 Windows EFI 分区 - 方寸之間 Scaleway IPV6 server 申请及使用攻略 - 方寸之間 Arch Linux 升级系统提示签名无效 - 方寸之間 Arch Linux 音响有杂音的解决办法 - 方寸之間 Arch Linux 如何切换内核 - 方寸之間 Django 项目时区更改错误的解决方案 - 方寸之間 超简单的 Arch Linux + Windows 双启动教程 - 方寸之間 使用 UFW 配置 Linux 防火墙 - 方寸之間 Git 中的一个特殊 hash - 方寸之間 深入理解数据库事务 - 方寸之間 CRLF 和 LF 之间的区别与联系 - 方寸之間 DNS 的更新是如何工作的? - 方寸之間 浅析 Linux 的 cron 命令 - 方寸之間 如何快速查看 github 代码库中早期 commits - 方寸之間 黑科技:使用 GitHub 搭建自己的短链接服务 - 方寸之間 Build site with Franklin.jl - 方寸之間 iwd 的使用教程 - 方寸之間 超好用的 UML 工具推荐 - 方寸之間 ArchLinux 安装配置笔记 (Updated) - 方寸之間 如何将 Julia 添加到 Jupyter Notebook - 方寸之間 费曼技巧:最好的学习方式 - 方寸之間 How to Create Linux Desktop Entry - 方寸之間 C++继承 多态 虚函数 - 方寸之間 C++ inline 关键字详解 - 方寸之間 C++ Static 关键字详解 - 方寸之間 C++ type conversion notes - 方寸之間 Solution for _CRT_SECURE_NO_WARNINGS error - 方寸之間 IR Homework - 方寸之間 Customize Ubuntu themes, icons and Shell - 方寸之間 恢复右键菜单的新建命令 - 方寸之間 Hugo+Github 搭建个人博客 - 方寸之間
Make a TODO robot with Github Actions - 方寸之間
Mercas · 2020-01-03 · via 方寸之間

Create a todolist robot with daily email notification

What’s Github Actions#

Github Actions is a CI(continuous integration) and CD(continuous deployment) service that help you automate your software development workflows in the same place you store code and collaborate on pull requests and issues. It was launched in October 2018 and was officially available to all users in November 2019. With Github Actions you can write individual tasks, called actions, and combine them to create a custom workflow. Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.

You can create workflows using actions defined in your repository, open source actions in a public repository on GitHub, or a published Docker container image. But workflows in forked repositories don’t run by default. If you don’t want to create your actions by yourself, you can discover actions in the GitHub Marketplace, also you can share your actions with the Marketplace.

Ok, now let’s go.

Getting started#

We can get this Send Mail Actions from here or source. It help us send email to our inbox.

Configuring Github Actions#

We should create a directory named .github/workflows to store our workflow files at the root of our repository. In .github/workflows, add a .yml or .yaml file for our workflow. For example, .github/workflows/auto.yml.

First we set a trigger#

name: GitHub Actions Email Bot

on:

schedule:

- cron: '0 22 * * *'

In the above code, name is actions description, on is the trigger condition. We use the POSIX cron syntax to schedule the workflow. It is triggered at 6<00am>(UTC+8) everyday.

Next writing a TODO list and converting it from markdown to html#

runs-on: ubuntu-latest

steps:

- name: Checkout

uses: actions/checkout@v2.0.0

- name: Get pandoc

run: sudo apt-get install pandoc

- name: Convert My TODO List

run: pandoc ./TODO.md > todo.html

Last configuring the send email actions#

- name: Send email

uses: dawidd6/action-send-mail@v1.3.0

with:

server_address: smtp.gmail.com

server_port: 465

username: ${{ secrets.MAIL_USERNAME }}

password: ${{ secrets.MAIL_PASSWORD }}

subject: My TODO List

body: file://todo.html

to: test@example.com

from: TODO List Notification

content_type: text/html

For security, we should set our email username and password in the settings/secrets menu of the project. I set my email username like MAIL_USERNAME, password like MAIL_PASSWORD.

Now we can receive a TODO list email every morning.


This is my full todo.yaml:

name: GitHub Actions Email Bot

on:

schedule:

- cron: '0 22 * * *'

jobs:

Todo_bot:

runs-on: ubuntu-latest

steps:

- name: Checkout

uses: actions/checkout@v2.0.0

- name: Get pandoc

run: sudo apt-get install pandoc

- name: Get My TODO List

run: pandoc ./TODO.md > result.html

- name: Send email

uses: dawidd6/action-send-mail@v1.3.0

with:

server_address: smtp.gmail.com

server_port: 465

username: ${{ secrets.MAIL_USERNAME }}

password: ${{ secrets.MAIL_PASSWORD }}

subject: TODO List

body: file://result.html

to: test@example.com

from: TODO List Notification

content_type: text/html