跳到正文
GitHub Changelog· Allison·· 4 天前精选AI 评分74

GitHub CLI 新增 Event Streams 支持,可通过单一命令监听 PR 事件

Wait for pull request events with GitHub CLI

AI 导读

GitHub CLI 在 gh v2.105.0 版本中支持 GitHub Event Streams,开发者与 AI 智能体可通过 gh event listen 命令直接监听 Pull Request 状态变化,无需循环轮询。

推荐理由

该功能用事件流监听替代低效的循环轮询,便于开发者和智能体以更低开销捕获代码审查与状态变更。

正文 · 原文

GitHub CLI now supports GitHub Event Streams. With gh v2.105.0, you and your agents can wait for a pull request to change with a single command instead of polling it in a loop.

Run gh event listen with a pull request URL and the events you care about, such as a submitted review. It creates the subscription, opens the stream and prints each event as a line of JSON.

  • By default, it exits after the first event, so it slots into scripts and agent loops.
  • Use --count to wait for several events, --follow to keep listening, and --timeout to stop waiting.
  • Use --jq or --template to pull out just the fields you need.

You can wait for submitted reviews, pull request state and head changes, merge conflicts and completed check suites. To manage subscriptions directly, use gh event subscription create, list, view, and delete.

Agents discover the new commands on their own: gh pr create, gh pr view, gh run view, gh run watch, and gh api now suggest gh event listen instead of polling.

Availability

The gh event commands are in preview and may change. They require access to Event Streams, which is in preview on GitHub.com. To get access, sign up for the Event Streams waitlist.

To get started, upgrade to gh v2.105.0 or later. For details, see the gh event manual and the Event Streams documentation, or run gh event --help.

Share your feedback in the GitHub Community discussion.

The post Wait for pull request events with GitHub CLI appeared first on The GitHub Blog.

来源:GitHub Changelog · github.blog

EVAOO 主站实战落地 · AI Agent 与研发提效

看完情报?回到 EVAOO 主站直接上手工具与完整 SOP

返回 EVAOO 主站