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

推荐订阅源

博客园_首页
Spread Privacy
Spread Privacy
D
Docker
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
F
Full Disclosure
美团技术团队
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
Security Latest
Security Latest
C
Check Point Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
罗磊的独立博客
A
Arctic Wolf
S
Schneier on Security
T
Threatpost
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
博客园 - 叶小钗
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
W
WeLiveSecurity
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
GbyAI
GbyAI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Heimdal Security Blog
L
LINUX DO - 热门话题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
O
OpenAI News
G
GRAHAM CLULEY
M
MIT News - Artificial intelligence
S
Security @ Cisco Blogs
博客园 - 司徒正美
N
News and Events Feed by Topic
Microsoft Azure Blog
Microsoft Azure Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Schneier on Security
Schneier on Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
月光博客
月光博客
The Last Watchdog
The Last Watchdog
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
C
Cisco Blogs
雷峰网
雷峰网

方寸之間

修复 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