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
update gitea-js
  • Loading branch information
anbraten committed Mar 5, 2022
commit 1d75b9dc84f44b5a5045108f2e6f45e0c7b87acd
3 changes: 2 additions & 1 deletion components/server/package.json
Original file line number Diff line number Diff line change
@@ -50,14 +50,15 @@
"cookie": "^0.4.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.4",
"cross-fetch": "^3.1.5",
"deep-equal": "^2.0.5",
"deepmerge": "^4.2.2",
"express": "^4.17.3",
"express-http-proxy": "^1.0.7",
"express-mysql-session": "^2.1.0",
"express-session": "^1.15.6",
"fs-extra": "^10.0.0",
"gitea-js": "^1.1.0",
"gitea-js": "^1.2.0",
"google-protobuf": "^3.18.0-rc.2",
"heapdump": "^0.3.15",
"inversify": "^5.0.1",
14 changes: 5 additions & 9 deletions components/server/src/gitea/api.ts
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
* See License-AGPL.txt in the project root for license information.
*/

import { Api, Commit as ICommit, Repository as IRepository, ContentsResponse as IContentsResponse, Branch as IBranch, Tag as ITag, PullRequest as IPullRequest, Issue as IIssue, User as IUser } from "gitea-js"
import fetch from 'node-fetch'
import { giteaApi, Api, Commit as ICommit, Repository as IRepository, ContentsResponse as IContentsResponse, Branch as IBranch, Tag as ITag, PullRequest as IPullRequest, Issue as IIssue, User as IUser } from "gitea-js"
import fetch from 'cross-fetch'

import { User } from "@gitpod/gitpod-protocol"
import { injectable, inject } from 'inversify';
@@ -36,14 +36,10 @@ export namespace Gitea {
}

export function create(host: string, token: string) {
return new Api({
return giteaApi(`https://${host}`, {
customFetch: fetch,
baseUrl: `https://${host}`,
baseApiParams: {
headers: {
"Authorization": token,
},
}});
token,
});
}

export type Commit = ICommit;
17 changes: 12 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -6091,6 +6091,13 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

cross-fetch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
dependencies:
node-fetch "2.6.7"

cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
@@ -8685,10 +8692,10 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

gitea-js@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/gitea-js/-/gitea-js-1.1.0.tgz#d538ce5ed1452346d5397720a8ed09f71abe8988"
integrity sha512-MtEEZjFIfsGNku7KEfELI6LIHy5JdZ8FVHEmvWdAgZWucC8GMj5wgsMN/t4N2qYIFG1RKDudSKXQNtCDOvulkQ==
gitea-js@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/gitea-js/-/gitea-js-1.2.0.tgz#b118b003c1ca4499d9ad0a4f15f343967a362cb4"
integrity sha512-/1Xqs8wVWnSTtIJ3JffXbPwVtmJjA+qjVnmdZ0DShj1RKgKzYlqfXT8JUJ7lBdLHXauZrp5VFqldIKrbmWCqKg==

glob-parent@^3.1.0:
version "3.1.0"
@@ -12144,7 +12151,7 @@ node-emoji@^1.11.0:
dependencies:
lodash "^4.17.21"

node-fetch@^2.1.2, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.5, node-fetch@^2.6.7:
node-fetch@2.6.7, node-fetch@^2.1.2, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.5, node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==