Skip to content

采集火烧云预测&通知 #108

采集火烧云预测&通知

采集火烧云预测&通知 #108

Workflow file for this run

name: "采集火烧云预测&通知"
# run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
schedule:
# - cron: '5 10,14,21 * * *' #At minute 5 past hour 10, 14, and 21.
- cron: '30 2,6,13 * * *' #github action的时区不是北京时间,所有都减去8
permissions: write-all # {{secrets.GITHUB_TOKEN}}的权限
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 打印当前时间
run: date
- name: 检查分支
uses: actions/checkout@v3
- name: 设置时区
uses: szenius/[email protected]
with:
timezoneLinux: "Asia/Shanghai"
timezoneMacos: "Asia/Shanghai"
timezoneWindows: "Shanghai Standard Time"
- name: 打印当前时间
run: date
- name: 安装python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: 安装依赖
run: pip install -r requirements.txt
- name: 修改日期
run: python change_date.py
- name: 采集微博
run: python crawler/weibo.py
- name: 复制记录&通知
env:
WX_TOKEN: ${{ secrets.WX_TOKEN }} # 微信通知token
WEATHER_API_KEY: ${{ secrets.WEATHER_API_KEY }} # 天气api key
run: python main.py "$WX_TOKEN" "$WEATHER_API_KEY"
- name: 判断是否有修改
id: verify_diff
run: |
git diff --quiet records/*.json || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit files
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add records/*.json
git commit -m "预测记录更新"
- name: 推送记录到github
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}