MCPcopy Create free account
hub / github.com/decaporg/decap-cms / forkExists

Method forkExists

packages/decap-cms-backend-forgejo/src/API.ts:1021–1036  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1019
1020 // Open Authoring (Fork) Support
1021 async forkExists(): Promise<boolean> {
1022 try {
1023 const repoName = this.originRepo.split('/')[1];
1024 const userRepoPath = `/repos/${this.repoOwner}/${repoName}`;
1025 const repo = (await this.request(userRepoPath)) as ForgejoRepository;
1026
1027 // Check if it's a fork and the parent is the origin repo
1028 const forkExists: boolean =
1029 repo.fork === true &&
1030 !!repo.parent &&
1031 repo.parent.full_name.toLowerCase() === this.originRepo.toLowerCase();
1032 return forkExists;
1033 } catch {
1034 return false;
1035 }
1036 }
1037
1038 async createFork(): Promise<ForgejoRepository> {
1039 return this.request(`${this.originRepoURL}/forks`, {

Callers 2

authenticateWithForkMethod · 0.45
API.spec.jsFile · 0.45

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected