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

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

GitHub Actions 教程:定时发送天气邮件 - 阮一峰的网络日志 (ruanyifeng.com)

https://github.com/ChuckFork/weather-action/

 

curl -H "Accept-Language: zh-CN" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" -o result.html "https://wttr.in/Shanghai?format=4&m"

需要加上https://的前缀,否则会有一个重定向的提示

 

想要在北京时间早上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:

Operator Description Example
* 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).

 

https://github.com/headllines/github-daily/issues/161

https://github.com/gautamkrishnar/keepalive-workflow

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(330)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-04-27 Problem: Traffic sent to http://localhost or http://127.0.0.1 is not captured
2020-04-27 Feature IIS return error 0x800F0922
2020-04-27 Windows 8.1 / Windows 10 breaks my ASP.NET / IIS : “Service unavailable”
2018-04-27 卡巴斯基升级之后win10的vpn无法连接
2016-04-27 ConcurrentDictionary中的 TryRemove
2016-04-27 enum类型
2015-04-27 父类和子类的构造函数
点击右上角即可分享
微信分享提示