跳转到主要内容
工作流目前处于测试阶段。在测试期间,所有方案当前均可免费使用。工作流功能、可用性和定价可能会发生变化。
工作流会在预设的计划下,或在存储库发生 push 时自动运行 agent。每个工作流都会为 agent 定义一个提示词,以及一个触发执行的条件。工作流同时支持 GitHub 和 GitLab 存储库。 当工作流运行时,agent 会将指定的存储库克隆为上下文,遵循提示词,并执行以下两种操作之一:要么创建一个拉取请求(或 GitLab 的合并请求),要么将更改直接推送到你的部署用分支。 每个工作流每天最多可运行 50 次。运行失败不会计入此限制。
使用按计划运行的工作流来自动化执行周期性任务,例如发布更新日志或检查语法和写作风格问题。使用在 push 事件上运行的工作流来自动化执行响应型维护任务,例如更新 API 参考文档,或识别新功能所需的文档更新。

创建工作流

  1. 打开 Workflows 页面。
  2. 点击 New workflow
  3. 配置工作流名称、触发器类型、存储库和计划。
  4. 编写 agent 指令,并选择是否自动合并拉取请求。
  5. 可选:启用 Slack 通知,以便在工作流完成时收到通知。
  6. 点击 Create workflow
新建工作流的设置页面。

配置

字段必填说明
Name在控制台中显示的名称。
Trigger触发器配置。
Context工作流运行时作为参考克隆的存储库。
Automerge默认关闭,此时会打开一个拉取请求以供审查。如果启用,则会打开一个拉取请求并自动将其合并。
Notify通知配置。工作流完成时发送 Slack 消息。
对于 GitHub 存储库,你必须在上下文或触发器字段中列出的每个存储库上安装 Mintlify GitHub App。请在 Mintlify 控制台的 GitHub app 页面中添加新的存储库。 对于 GitLab 存储库,你必须在 Mintlify 控制台的 GitLab OAuth 页面上连接你的 GitLab 账户。然后添加你想要与工作流一起使用的存储库。你必须在每个项目上至少拥有 Maintainer 角色才能连接 GitLab OAuth。
GitHub app 页面显示了两个组织已连接的存储库。

触发器

每个工作流必须定义一个触发器。

按计划 (cron)

使用 cron 表达式按固定计划运行工作流。所有计划均使用 UTC 时间运行。 工作流会在预定时间起的 10 分钟内进入队列,并且可能最多需要 10 分钟才能开始运行。 该值是一个标准的 5 个字段的 cron 表达式,格式为 minute hour day-of-month month day-of-week。可以使用类似 crontab.guru 这样的工具来构建和验证调度计划。
表达式计划
0 9 * * 1每周一 9:00 (UTC)
0 0 1 * *每个月第一天的 00:00 (UTC,午夜)
0 8 * * 1-5每个工作日 8:00 (UTC)

在 push 事件时

当更改被推送到指定存储库或特定 branch 时运行工作流。这包括拉取请求合并和直接推送到该 branch 的操作。 owner/repo 格式指定每个存储库。可选指定要监控的 branch。如果你未指定 branch,则工作流会在更改推送到存储库默认 branch 时触发。 一个工作流可以监控最多 10 个存储库或 branch 上的推送。

Context 存储库

Context 存储库在工作流运行时为 agent 提供对其他存储库的只读访问权限。当你的提示词需要查看文档存储库之外的代码或内容时,这会很有用。每个工作流最多可以指定五个上下文存储库。

自动合并更改

默认情况下,agent 会为每次工作流运行创建一个拉取请求,以便你在更改上线之前进行审查。启用自动合并可自动合并该拉取请求,无需手动批准。这样一来,你既可以在存储库的拉取请求历史记录中保留更改记录,又能自动完成合并步骤。
对于 GitHub 存储库,自动合并要求 Mintlify GitHub 应用对所有针对你部署分支的规则集都拥有绕过权限,包括组织级和仓库级的规则集。请参阅配置自动合并了解设置说明。对于 GitLab 存储库,自动合并使用在 Mintlify 控制台的 GitLab OAuth 页面上配置的 GitLab OAuth 连接。你必须在每个项目上至少拥有 Maintainer 角色才能连接 GitLab OAuth。

Slack 通知

在工作流完成或失败时发送 Slack 消息。通知内容包括工作流状态、拉取请求链接以及变更摘要。
Slack 通知要求你的组织的 Slack 工作区中已安装 Mintlify Slack 应用。请从你的控制台安装 Slack 应用。
在控制台中创建或编辑工作流时,在 Notify on completion 开关下启用 Slack 通知:
  1. 如果你尚未连接 Slack,请点击 Install Slack app
  2. 点击 Notify on completion 开关。
  3. 搜索并选择你想要通知的频道。
  4. 保存你的工作流。

管理工作流

从控制台的 Workflows 页面编辑、删除、禁用或触发工作流。

手动触发工作流

你可以按需运行基于 cron 的工作流,无需等待下一个计划时间。手动触发的运行会计入每日运行限制。
  1. 前往控制台中的 Workflows 页面。
  2. 点击 View workflows 查看所有工作流。
  3. 点击你要运行的工作流。
  4. 点击 手动触发工作流按钮来触发工作流。

禁用工作流

禁用工作流可以暂时停止其运行,而无需删除它。已禁用的工作流会保留其配置和运行历史,但不会按计划执行,也不会响应推送事件。你无法手动触发已禁用的工作流。 切换工作流状态:
  1. 前往控制台中的 Workflows 页面。
  2. 点击 View workflows 查看所有工作流。
  3. 点击你要禁用或启用的工作流。
  4. 点击 Active 开关以禁用工作流,或将其打开以启用。
  5. 点击 Save changes
当你重新启用基于 cron 的工作流时,Mintlify 会从当前时间重新计算下次运行时间。

GitLab 设置

要在工作流中使用 GitLab 存储库,请通过 GitLab OAuth 设置页面上的 GitLab OAuth 集成连接每个项目。你必须连接工作流涉及的所有存储库,包括你的文档存储库以及任何触发或上下文存储库。
工作流需要 GitLab 付费版本。Agent 使用短期项目访问令牌来访问存储库,而 GitLab 免费版不支持此功能。

提示词

有效的提示词会专注于单一任务,并有清晰的预期结果。由于 Agent 的非确定性特性,工作流总会存在一定差异,但你可以通过遵循以下最佳实践来提高工作流输出的一致性。
  • 描述你希望 Agent 达成的结果。
  • 包含衡量成功的标准。
  • 指定你希望 Agent 使用的 context。
  • 将复杂任务拆分为步骤或多个工作流。

Agent 环境

agent 在隔离的沙箱中运行,且互联网访问受限。编写提示时,只应提及 agent 可用的工具。
  • 标准 shell 实用工具 (grepsedawkcurl 等)
  • git 和 GitHub CLI (gh)
  • Mintlify CLI (mint)
  • Node.js 和 Bun
agent 无法在运行时安装额外的软件包或工具。软件包注册表和其他外部服务在沙箱中均不可访问。 要求 agent 运行不可用工具的提示可能会产生意外结果或失败。

示例提示词

以下示例提示词展示了常见的工作流模式。在控制台中创建工作流,并将提示词粘贴到指令字段中。

新功能文档草稿

如果你在控制台中使用智能代理建议 (agent suggestions),此工作流会复现相同的行为。按项目需要对该工作流进行必要修改后添加,即可在为产品添加新功能时自动起草文档。
Trigger: On push to your-org/your-product (main branch) Context repos: your-org/your-docs
Review the diff from the last merged PR in `your-org/your-product`. Identify any new features, APIs, or other changes that require documentation.

For each new addition, draft documentation updates that explain what it does, when to use it, and how to configure it. Include a code example where relevant.

Success criteria: After reading any new or updated documentation, users understand what the feature is, if it applies to tasks they do, and how to use it.

## Important

- Only document changes that affect end users. Skip internal refactors or dependency updates.
- Match the style and structure of existing docs pages.

样式审查

Trigger: On push to your-org/your-docs (main branch)
Review all MDX files changed in the last merged PR against the style guide at `path/to/style-guide`.

Open a pull request to resolve any style violations that can be fixed automatically. For any edits that require judgment or nuance, note them in the PR body with the specific lines, rule violations, and suggested fixes.

Success criteria:
- All style violations have a proposed resolution.
- No new style violations are introduced.

## Important

- Do not change content meaning. Only correct style violations.
- Skip any files in language subdirectories (`es/`, `fr/`, `zh/`).

更新 API 参考文档

Trigger: On push to your-org/your-product (main branch) Context repos: your-org/your-docs
Review the diff from the last merged PR in `your-org/your-product` for changes to API endpoints, parameters, response shapes, or error codes.

Update the corresponding API specifications or pages in the docs to reflect the changes. Include updated parameter descriptions, type information, and examples where affected.

Success criteria: All API specifications and pages are up to date with the changes in the product repository.

## Important

- If a parameter or endpoint was removed, mark it as deprecated rather than deleting it unless the code explicitly removes it with no deprecation period.
- If no API changes were introduced, do nothing.

跟踪翻译进度滞后

Trigger: Cron schedule 0 9 * * 3(每周三 9:00 UTC) 将示例语言子目录 (es/fr/zh/) 更新为你实际使用的语言子目录。
Compare the English MDX files in the repo against their counterparts in the `es/`, `fr/`, and `zh/` subdirectories. Use git history to identify English files updated more recently than their translations.

Open a pull request that lists pages that are out of sync, organized by language. For each page, include the date of the last English update and a brief summary of what changed so translators have context on what to update.

Success criteria: Any discrepancies between the English and translated files are identified and listed in the pull request.

## Important

- If a translated file does not exist, flag it as missing rather than out of sync.
- Group findings by language, then by how far out of date they are (most stale first).

SEO 和 metadata 审核

Trigger: Cron schedule 0 9 * * 1(每周一 9:00 UTC)
Audit all MDX files in the docs for SEO and metadata quality. Check for:

- Missing or empty `title` frontmatter
- Titles that are too long (over 60 characters) — long titles are truncated in search result snippets
- Titles that follow a boilerplate pattern like "PageType - Name" without describing the specific content of the page
- Missing or empty `description` frontmatter (see OpenAPI pages below — do not treat as missing when an OpenAPI spec supplies the description)
- Descriptions that are too short (under 130 characters) — short descriptions are frequently ignored by Google in favor of auto-generated snippets
- Descriptions that are too long (over 160 characters)
- Pages that share an identical description with other pages — each page needs a unique description

Open a pull request with improvements for any issues found.

When writing titles: be descriptive and specific about what the page covers. Avoid generic patterns like "Overview - Product Name". Target 50-60 characters.

When writing descriptions: summarize what the specific page covers in plain language. Include 2-3 terms a user would actually search for. Never reuse the same description across pages. Target 130-155 characters.

### Pages with `openapi:` in frontmatter (API reference from spec)

The `openapi:` frontmatter value can be either an **operation reference** (e.g., `openapi: GET /users/{id}`) or a **file reference** (e.g., `openapi: ./openapi.yaml`). Only operation references supply per-page `summary` and `description` from the spec.

For pages with an **operation reference**:
- Read the referenced OpenAPI spec file to check whether the operation defines a `description`.
- If the operation **has** a `description`: do not add a `description:` field to frontmatter. If one was incorrectly added, remove it so the metadata comes from the spec.
- If the operation **has no** `description`: audit `description` frontmatter as normal — add one if missing or fix it if it fails the quality checks.
- If the operation defines a `summary` and the page has no `title:` frontmatter, treat the title as present — do not add one.
- Never edit the OpenAPI spec files themselves.

For pages with a **file reference**, audit all frontmatter fields as normal.

Success criteria:
- Pages have a unique title under 60 characters that describes the specific content
- Pages have a unique description between 130 and 160 characters (except for pages where the OpenAPI spec supplies the description)

## Important

- Only update frontmatter. Do not change page content or OpenAPI spec files.
- If all pages have complete and reasonable metadata, do nothing.

带通知的更新日志

Trigger: Cron schedule 0 9 * * 1(每周一 9:00 UTC) Context repos: your-org/your-product Slack notifications: documentation 频道,tech-writer 用户
Review all merged PRs in `your-org/your-product` from the past week. Draft a changelog entry summarizing new features, bug fixes, and breaking changes.

Success criteria: The changelog accurately reflects the week's changes and is ready for review.