Skip to content

关于本页

本页介绍更夫所基于的开源内核 Keep 的通用能力。更夫在其上提供国内化增强:钉钉/企业微信/飞书通知、国产大模型接入、LDAP 认证与值班管理。部署与上手请看快速上手。

本文档提供了关于如何在 GitHub Actions 工作流中使用 Keep CLI 来同步和管理 Keep 工作流的详细指南。此设置自动化了将工作流上传到 Keep 的过程,使维护和更新工作流变得更加容易。

配置 ​

要在您的仓库中设置此工作流:

  • 将工作流 YAML 文件添加到仓库的 .github/workflows/ 目录下。
  • 如果您还没有设置,请在仓库设置中将您的 Keep API 密钥和 URL 设置为 secrets。
  • 在指定目录中对工作流进行更改,或通过 GitHub UI 手动触发工作流。
  • 将 'example/workflows/**' 更改为您存储 Keep 工作流的目录。

GitHub Action 工作流 ​

此 GitHub Actions 工作流在有更改时自动将工作流从指定目录同步到 Keep。它还支持使用可选参数手动触发。

yaml
# 一个从目录同步 Keep 工作流的工作流
name: "Sync Keep Workflows"

on:
    push:
        paths:
          - 'examples/workflows/**'
    workflow_dispatch:
        inputs:
            keep_api_key:
              description: 'Keep API Key'
              required: false
            keep_api_url:
              description: 'Keep API URL'
              required: false
              default: 'https://api.keephq.dev'

jobs:
    sync-workflows:
        name: Sync workflows to Keep
        runs-on: ubuntu-latest
        container:
            image: us-central1-docker.pkg.dev/keephq/keep/keep-cli:latest
        env:
            KEEP_API_KEY: ${{ secrets.KEEP_API_KEY || github.event.inputs.keep_api_key }}
            KEEP_API_URL: ${{ secrets.KEEP_API_URL || github.event.inputs.keep_api_url }}

        steps:
        - name: Check out the repo
          uses: actions/checkout@v2

        - name: Run Keep CLI
          run: |
            keep workflow apply -f examples/workflows

基于 MIT 协议开源的 Keep · 由更夫社区维护