Skip to content

Commit

Permalink
feat($): update
Browse files Browse the repository at this point in the history
  • Loading branch information
liguoqinjim committed Sep 14, 2023
1 parent 1fdfd2e commit a249cff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,38 @@ jobs:
- name: 打印当前时间
run: date

- name: 进入目录
run: cd v1

- name: 安装python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: 安装依赖
working-directory: ./v1
run: pip install -r requirements.txt

- name: 修改日期
working-directory: ./v1
run: python change_date.py

- name: 采集微博
working-directory: ./v1
run: python crawler/weibo.py

- name: 复制记录&通知
working-directory: ./v1
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
working-directory: ./v1
run: |
git diff --quiet records/*.json || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit files
working-directory: ./v1
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: "采集火烧云预测&通知v2"
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
# 每天更新两次,分别在8:30-10:30以及20:30-22:30更新
- cron: '0 3,15 * * *' #github action的时区不是北京时间,所有都减去8

permissions: write-all # {{secrets.GITHUB_TOKEN}}的权限

Expand All @@ -28,9 +28,6 @@ jobs:
- name: 打印当前时间
run: date

- name: 进入目录
run: cd v2

- name: 安装python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -62,16 +59,19 @@ jobs:
run: python main.py "$BAIDU_API_KEY" "$BAIDU_SECRET_KEY" "$WX_TOKEN"

- name: 判断是否有修改
working-directory: ./v2
id: verify_diff
run: |
git diff --quiet records/*.json || echo "changed=true" >> $GITHUB_OUTPUT
git diff --quiet records || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit files
working-directory: ./v2
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 add records/images/*.webp
git add records/json/*.json
git commit -m "预测记录更新"
- name: 推送记录到github
Expand Down

0 comments on commit a249cff

Please sign in to comment.