mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Keeps a fork issue’s details, metadata and edits bound to the repository the user opened, including same-number issues in fork and upstream. Repairs selected-assignee leakage and delayed failed edits repainting another issue. Fixes #24378 Incorporates and cross-reviews contributor PR #24379, including its source-resolver correction and regression material. Covers the contributor PR’s Project-row identity and retained-dialog mutation findings. The final published head passes focused tests, hidden macOS rendering and current CI; the callback-timing bot thread has an evidence-based response. Co-authored-by: Katsuma Takehisa <k.takehisa@nissogr.com>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { GITHUB_OWNER_SLUG_RE } from '../../shared/github/owner-slug'
|
|
import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types'
|
|
|
|
export type GitHubApiRepositoryResolution =
|
|
| GitHubOwnerRepo
|
|
| null
|
|
| undefined
|
|
| (() => Promise<GitHubOwnerRepo | null>)
|
|
|
|
// Why: renderer/RPC overrides reach authenticated REST paths.
|
|
const OWNER_SLUG_RE = GITHUB_OWNER_SLUG_RE
|
|
const REPOSITORY_SLUG_RE = /^[A-Za-z0-9._-]+$/
|
|
|
|
export function isValidGitHubApiRepository(repository: unknown): repository is GitHubOwnerRepo {
|
|
if (
|
|
!repository ||
|
|
typeof repository !== 'object' ||
|
|
!('owner' in repository) ||
|
|
!('repo' in repository)
|
|
) {
|
|
return false
|
|
}
|
|
return (
|
|
typeof repository.owner === 'string' &&
|
|
typeof repository.repo === 'string' &&
|
|
(!('host' in repository) ||
|
|
repository.host === undefined ||
|
|
typeof repository.host === 'string') &&
|
|
OWNER_SLUG_RE.test(repository.owner) &&
|
|
REPOSITORY_SLUG_RE.test(repository.repo) &&
|
|
repository.repo !== '.' &&
|
|
repository.repo !== '..'
|
|
)
|
|
}
|