You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过gh或REST API设置仅关注仓库的发布更新

仅关注GitHub仓库Release更新的实现方案

目前gh watch命令确实没有原生的release only参数来直接实现仅关注仓库Release的需求,不过可以通过以下两种方式解决:

1. 网页端配置+CLI确认

  • 打开目标仓库的GitHub页面,点击顶部的「Watch」下拉按钮,选择「Custom」选项;
  • 在弹出的窗口中,只勾选「Releases」,取消其他选项后保存;
  • 可通过CLI命令确认当前关注状态:
    gh repo view <repo_url> --json watchers,subscription
    

2. 用gh api直接修改订阅配置

通过GitHub REST API的仓库订阅接口,手动构造请求实现仅关注Release:

  • 先提取仓库的owner和名称(例如https://github.com/octocat/hello-world的owner是octocat,仓库名是hello-world);
  • 执行以下命令完成配置:
    gh api --method PUT repos/{owner}/{name}/subscription \
      -f subscribed=true \
      -f ignored=false \
      -f subscribed_events[]=release
    
  • 验证配置是否生效:
    gh api repos/{owner}/{name}/subscription
    
    返回结果里的subscribed_events数组应仅包含"release"。

内容的提问来源于stack exchange,提问作者jebarpg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 07:03:14