# 工作流名称:为 Issues 添加标签 name: 'Label Issues' # 触发条件:定义工作流在哪些事件发生时运行 on: workflow_dispatch: # 允许手动触发工作流 issues: types: [opened, closed, labeled] # 当 issues 被打开、关闭或添加标签时触发 pull_request_target: types: [closed, labeled] # 当 PR 被关闭或添加标签时触发(使用 target 分支上下文) schedule: - cron: '0 * * * *' # 定时触发,每小时执行一次(分钟 小时 日 月 周) # 权限设置:工作流运行时拥有的权限 permissions: issues: write # 允许对 issues 执行写操作(如添加标签) pull-requests: write # 允许对 PR 执行写操作(如添加标签) jobs: action: # 定义一个名为 action 的任务 runs-on: ubuntu-latest # 任务运行在最新版 Ubuntu 系统上 if: github.repository_owner == 'TryGhost' # 仅当仓库所有者为 TryGhost 时才执行 steps: # 步骤:使用自定义动作处理标签操作 - uses: tryghost/actions/actions/label-actions@main # 引用 TryGhost 组织下的 label-actions 动作(main 分支)