Repos transferred into the org are not synced (no repository.transferred handler)

未关闭 适合新手
#1,107 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@breymander 已经在做这个了。

开始于 2026年10月13日。

  • #1108 来自 @breymander —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
backend

调研方向

事件处理程序在 index.js 中注册,该文件已覆盖 repository.created、edited、renamed、archived 和 unarchived,但未覆盖 repository.transferred。请阅读 repository.created 的处理程序,并为新事件复用其同步路径。完成标准是:一次 repository.transferred 投递能触发与 repository.created 相同的合并 org、suborg 和 repo 配置同步。同时检查现有的处理程序测试仍然通过。

由索引模型根据 Issue 内容生成。

描述

Problem Description

What is actually happening

When a repository is transferred into an org that safe-settings manages, safe-settings does nothing. The org defaults, suborg settings and the repo's own .github/repos/<repo>.yml are not applied until something else triggers a sync, usually the next CRON full sync or a human editing the repo.

We hit this during an org-to-org migration:

  1. Merged .github/repos/<repo>.yml into the admin repo while the repo still lived in the source org. The push-triggered sync failed with 404 Not Found on Autolinks, Teams and Environments for that repo, which is expected since it did not exist in the org yet.
  2. Transferred the repo into the org.
  3. GitHub delivered repository.transferred to the receiving org's installation. safe-settings logged nothing for the repo and applied nothing.

The repo stayed on its pre-transfer settings until the next cron run. In our case that meant missing team grants, missing autolinks, repo flags not matching org defaults, and environment reviewers still pointing at teams in the old org.

What is the expected behavior

A repo transferred into the org should be treated like repository.created: the merged org, suborg and repo config is applied right away.

index.js registers handlers for repository.created, edited, renamed, archived and unarchived, but not repository.transferred. Per the webhook docs, transferred is sent to the account the repo is transferred to, so the receiving installation already gets the event. It just isn't handled. The App already subscribes to repository events, so no permission or subscription change is needed.

Error output, if available

Push-triggered sync before the transfer (expected, repo not yet in the org):

ERROR (event): Error HttpError: Not Found - https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository in Autolinks for repo: {"repo":"<repo>","owner":"<org>"}
ERROR (event): Error HttpError: Not Found - https://docs.github.com/rest/repos/repos#list-repository-teams in Teams for repo: {"repo":"<repo>","owner":"<org>"}
ERROR (event): Error HttpError: Not Found - https://docs.github.com/rest/deployments/environments#list-environments in Environments for repo: {"repo":"<repo>","owner":"<org>"}

After the transfer: no log lines for the repo at all.

Context

Are you using the hosted instance of probot/settings or running your own?

Running our own (Helm chart, ghcr.io/github-community-projects/safe-settings).

If running your own instance, are you using it with github.com or GitHub Enterprise?

github.com (GitHub Enterprise Cloud)

Version of probot/settings

safe-settings 3.0.0 (also checked main-enterprise at 4dac294, same behavior)

Version of GitHub Enterprise

GHEC

Workaround

Any human edit to the repo after the transfer (for example gh repo edit <org>/<repo> --description "...") fires repository.edited and triggers a sync. Alternatively, merge the per-repo yml after the transfer so the push-triggered sync finds the repo.

I'll open a PR that adds a repository.transferred handler mirroring repository.created.

主要语言
JavaScript
星标
927
派生
234
平均合并
2 天 15 小时
30 天内合并 PR
11

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github-community-projects/safe-settings 的其他 Issue

查看 github-community-projects/safe-settings 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。