【发布时间】:2021-11-26 13:10:41
【问题描述】:
我有一个简单的机器人,可以读取某些电子邮件并在推特上发布它们。现在我正在尝试自动化它,为此我需要在服务器上运行一个 cron 作业。这是我的文件夹结构:
┌ .github
│ └── workflows
│ └── main.yml
├ .env
├ .gitignore
├ app.py
├ post_tweet.py
└ read_email.py
我的主文件很简单:
#app.py
from read_email import mail_connect
def main():
mail_connect()
if __name__ == '__main__':
main()
整个项目托管在 Vercel(并与 GitHub 集成)。我想运行这个app.py 文件,从我读过的内容来看,我需要在 GitHub 上创建一个工作流来运行它,但我遇到了一些困难(并且有点不确定它是否会工作)。
#main.yml
on:
schedule:
- cron: "*/10 11-13 * * 1-5"
jobs:
build:
runs-on: ubuntu-latest
- uses: actions/checkout@v2 #Do I need this?
- name: Run a one-line script
run: #What could I enter here to run app.py?
在我写这个问题的时候,我也想到了以下问题:我真的需要像 Vercel 这样的服务器来运行它吗?还是只用 GitHub 就可以完成所有事情?
【问题讨论】:
标签: python github-actions