首页 > 其他 > 详细

GitHub Actions 教程:定时发送天气邮件

时间:2021-04-27 22:09:16      阅读:20      评论:0      收藏:0      [点我收藏+]

GitHub Actions 教程:定时发送天气邮件

想要在北京时间早上5点收到一封邮件,那么需要倒推8个小时的UTC时间,来发送邮件。

24+5-8=21

所以schedule的时间如下:

on:
  push:
  schedule:
    - cron: ‘0 21 * * *‘

在push以及指定时间进行触发

 

邮箱服务器建议使用outlook的office365,

qq邮箱要求授权码,需要手机主动发短信

网易163邮箱注册的时候要求手机主动发短信

 

GitHub Actions 入门教程

https://docs.github.com/en/actions/reference/events-that-trigger-workflows

This example triggers the workflow every day at 5:30 and 17:30 UTC:

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  ‘30 5,17 * * *‘

Cron syntax has five fields separated by a space, and each field represents a unit of time.

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
│ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
│ │ │ │ │                                   
│ │ │ │ │
│ │ │ │ │
* * * * *

You can use these operators in any of the five fields:

OperatorDescriptionExample
* Any value * * * * * runs every minute of every day.
, Value list separator 2,10 4,5 * * * runs at minute 2 and 10 of the 4th and 5th hour of every day.
- Range of values 0 4-6 * * * runs at minute 0 of the 4th, 5th, and 6th hour.
/ Step values 20/15 * * * * runs every 15 minutes starting from minute 20 through 59 (minutes 20, 35, and 50).

GitHub Actions 教程:定时发送天气邮件

原文:https://www.cnblogs.com/chucklu/p/14710742.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!