From a249cff772ec80339ef261d9acb99adaef25114a Mon Sep 17 00:00:00 2001 From: liguoqinjim Date: Thu, 14 Sep 2023 10:35:52 +0800 Subject: [PATCH] feat($): update --- .github/workflows/v1.yml | 9 ++++++--- .github/workflows/v2.yml | 14 +++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/v1.yml b/.github/workflows/v1.yml index 75e7221..5493879 100644 --- a/.github/workflows/v1.yml +++ b/.github/workflows/v1.yml @@ -28,24 +28,25 @@ 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 @@ -53,10 +54,12 @@ jobs: - 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" diff --git a/.github/workflows/v2.yml b/.github/workflows/v2.yml index 4b5d9bf..23a273c 100644 --- a/.github/workflows/v2.yml +++ b/.github/workflows/v2.yml @@ -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}}的权限 @@ -28,9 +28,6 @@ jobs: - name: 打印当前时间 run: date - - name: 进入目录 - run: cd v2 - - name: 安装python uses: actions/setup-python@v4 with: @@ -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