Gmeek icon indicating copy to clipboard operation
Gmeek copied to clipboard

工作流触发规则修改

Open tiengming opened this issue 6 months ago • 3 comments

主要的修改是:

  1. 在 on 部分添加了 push 事件,并指定了 main 分支(你可以根据需要修改分支名)。这样,每当有代码推送到 main 分支时,工作流就会被触发。
  2. 在 if 条件中添加了 || github.event_name == 'push',确保推送事件也能触发 job 的执行。
  3. 修正了 cron 表达式中的错误(原来的 "0 16 * **" 改为 "0 16 * * *")。

有了这些修改,工作流现在会在以下情况下触发:

  1. 手动触发
  2. 代码被推送到 main 分支
  3. Issues 被创建或编辑
  4. 每天 16:00 UTC 定时触发
name: build Gmeek
on:
  workflow_dispatch:
  push:
    branches:
      - main  # 或者你的默认分支名称
  issues:
    types: [opened, edited]
  schedule:
    - cron: "0 16 * * *"
    
jobs:
  build:
    name: Generate blog
    runs-on: ubuntu-20.04
    if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' || github.event_name == 'push' }}
    permissions: write-all
    steps:
      # ... 其余步骤保持不变

tiengming avatar Aug 16 '24 05:08 tiengming