利用github定时执行任务

1、前言


之前用node写了个程序,想要他每天定时执行,但是不想买云服务器也不想自己电脑当服务器天天开着机,无意中发现github可以实现该需求。

2、 github怎么实现


利用github Actions实现。

步骤:
1、程序上传到github,点击【Actions】

![image.png](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/140229c6001c46f5afd7bfffa6235a05~tplv-k3u1fbpfcp-watermark.image?)
2、在该tab页中,向下滚动找到node相关的(我的是node的,按照自己实际代码找对应的)

![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8a40ca31a6e447dfa8e4c551dae2dfff~tplv-k3u1fbpfcp-watermark.image?)

3、点击 【Set up this workflow】按钮建立yml文件

# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  schedule:
    - cron:  '0 1 * * *'

job
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值