Github Action初体验
Github Action
今天小小地了解了一下Github Action这个东西
感觉它实际上就是一个轻量级服务器而已
用户每个月有限制内存和运行时间,但是基本上不用担心用完
Action可以选择很多模板,也可以自己设置定时任务。
文件是yaml类型,语法不难理解
尝试几次就成功把以前那个该死的经典诵读文件做成一个定时任务了。
感觉很好的是密钥的添加很方便,也很好管理
但是,还是要翻旧账批评它没有一键删除history这个功能
这个定时任务文件代码放在这里了,有需要的自己改了用吧
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
schedule:
# 定时任务,在每天的上午11点推送天气信息到邮箱
- cron: '0 3 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip3 install requests
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: RunScripts
run: |
# stop the build if there are Python syntax errors or undefined names
python 程序.py
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide