Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea support #8131

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format code
  • Loading branch information
ghuntley committed Mar 17, 2022
commit ad2d2b212b8c1f77416f20ff252205334d07df7f
46 changes: 26 additions & 20 deletions components/server/src/gitea/convert.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
import { Repository } from '@gitpod/gitpod-protocol';
import { RepoURL } from '../repohost';
/**
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

import { Repository } from "@gitpod/gitpod-protocol";
import { RepoURL } from "../repohost";
import { Gitea } from "./api";

export function convertRepo(repo: Gitea.Repository): Repository | undefined {
if (!repo.clone_url || !repo.name || !repo.owner?.login) {
return undefined;
}
export function convertRepo(repo: Gitea.Repository): Repository | undefined {
if (!repo.clone_url || !repo.name || !repo.owner?.login) {
return undefined;
}

const host = RepoURL.parseRepoUrl(repo.clone_url)!.host;
const host = RepoURL.parseRepoUrl(repo.clone_url)!.host;

return {
host,
owner: repo.owner.login,
name: repo.name,
cloneUrl: repo.clone_url,
description: repo.description,
avatarUrl: repo.avatar_url,
webUrl: repo.html_url, // TODO: is this correct?
defaultBranch: repo.default_branch,
private: repo.private,
fork: undefined // TODO: load fork somehow
}
return {
host,
owner: repo.owner.login,
name: repo.name,
cloneUrl: repo.clone_url,
description: repo.description,
avatarUrl: repo.avatar_url,
webUrl: repo.html_url, // TODO: is this correct?
defaultBranch: repo.default_branch,
private: repo.private,
fork: undefined, // TODO: load fork somehow
};
}

// export function convertBranch(repo: Gitea.Repository): Branch | undefined {

// }
// }