- improve formatting
- add some more comments
This commit is contained in:
+12
-7
@@ -1764,6 +1764,9 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
|||||||
get defaultUrl() {
|
get defaultUrl() {
|
||||||
return 'https://gitea.com';
|
return 'https://gitea.com';
|
||||||
}
|
}
|
||||||
|
get homeUrl() {
|
||||||
|
return 'https://gitea.com';
|
||||||
|
}
|
||||||
constructor(token, url, repositoryPath) {
|
constructor(token, url, repositoryPath) {
|
||||||
super(token, url, repositoryPath);
|
super(token, url, repositoryPath);
|
||||||
this.mapComment = (comment) => {
|
this.mapComment = (comment) => {
|
||||||
@@ -1830,6 +1833,10 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
|||||||
reviews: undefined
|
reviews: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* WARNING: This does not actually get the diff from the remote, as Gitea does not offer a compareable API.
|
||||||
|
* This uses the local repository to get the diff. NOTE: As such, gitea integration requires the repo available.
|
||||||
|
*/
|
||||||
getDiffRemote(owner, repo, base, head) {
|
getDiffRemote(owner, repo, base, head) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let changedFilesCount = 0;
|
let changedFilesCount = 0;
|
||||||
@@ -1952,7 +1959,7 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
|||||||
getTags(owner, repo, maxTagsToFetch) {
|
getTags(owner, repo, maxTagsToFetch) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`start to get gitea tag `);
|
core.debug(`Start to get tag from gitea`);
|
||||||
const response = yield this.api.repos.repoListTags(owner, repo, {
|
const response = yield this.api.repos.repoListTags(owner, repo, {
|
||||||
limit: maxTagsToFetch
|
limit: maxTagsToFetch
|
||||||
});
|
});
|
||||||
@@ -1972,9 +1979,6 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
|||||||
return tagsInfo;
|
return tagsInfo;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
get homeUrl() {
|
|
||||||
return 'https://gitea.com';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.GiteaRepository = GiteaRepository;
|
exports.GiteaRepository = GiteaRepository;
|
||||||
GiteaRepository.pulls = {
|
GiteaRepository.pulls = {
|
||||||
@@ -2254,6 +2258,10 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
|
|||||||
get defaultUrl() {
|
get defaultUrl() {
|
||||||
return 'https://api.github.com';
|
return 'https://api.github.com';
|
||||||
}
|
}
|
||||||
|
get homeUrl() {
|
||||||
|
var _a;
|
||||||
|
return ((_a = this.url) === null || _a === void 0 ? void 0 : _a.replace('api.', '')) || 'https://github.com';
|
||||||
|
}
|
||||||
constructor(token, url, repositoryPath) {
|
constructor(token, url, repositoryPath) {
|
||||||
super(token, url, repositoryPath);
|
super(token, url, repositoryPath);
|
||||||
this.mapPullRequest = (pr, status = 'open') => {
|
this.mapPullRequest = (pr, status = 'open') => {
|
||||||
@@ -2384,9 +2392,6 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
get homeUrl() {
|
|
||||||
return 'https://github.com';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.GithubRepository = GithubRepository;
|
exports.GithubRepository = GithubRepository;
|
||||||
|
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -12,7 +12,9 @@ export abstract class BaseRepository {
|
|||||||
// Define an abstract getter for the default URL
|
// Define an abstract getter for the default URL
|
||||||
abstract get defaultUrl(): string
|
abstract get defaultUrl(): string
|
||||||
|
|
||||||
|
// Define the abstract getter for the home URL (also used for some replace patterns)
|
||||||
abstract get homeUrl(): string
|
abstract get homeUrl(): string
|
||||||
|
|
||||||
protected constructor(
|
protected constructor(
|
||||||
protected token: string,
|
protected token: string,
|
||||||
protected url: string | undefined,
|
protected url: string | undefined,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {Api, PullRequest, PullReview, giteaApi} from 'gitea-js'
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {createCommandManager} from '../pr-collector/gitHelper'
|
import {createCommandManager} from '../pr-collector/gitHelper'
|
||||||
|
|
||||||
interface Pulls {
|
interface Pulls {
|
||||||
closed: PullRequest[]
|
closed: PullRequest[]
|
||||||
open: PullRequest[]
|
open: PullRequest[]
|
||||||
@@ -85,6 +86,10 @@ export class GiteaRepository extends BaseRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WARNING: This does not actually get the diff from the remote, as Gitea does not offer a compareable API.
|
||||||
|
* This uses the local repository to get the diff. NOTE: As such, gitea integration requires the repo available.
|
||||||
|
*/
|
||||||
async getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> {
|
async getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> {
|
||||||
let changedFilesCount = 0
|
let changedFilesCount = 0
|
||||||
let additionCount = 0
|
let additionCount = 0
|
||||||
@@ -223,7 +228,7 @@ export class GiteaRepository extends BaseRepository {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async getTags(owner: string, repo: string, maxTagsToFetch: number): Promise<TagInfo[]> {
|
async getTags(owner: string, repo: string, maxTagsToFetch: number): Promise<TagInfo[]> {
|
||||||
core.debug(`start to get gitea tag `)
|
core.debug(`Start to get tag from gitea`)
|
||||||
const response = await this.api.repos.repoListTags(owner, repo, {
|
const response = await this.api.repos.repoListTags(owner, repo, {
|
||||||
limit: maxTagsToFetch
|
limit: maxTagsToFetch
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ export class GithubRepository extends BaseRepository {
|
|||||||
body: comment.body,
|
body: comment.body,
|
||||||
state: comment.state
|
state: comment.state
|
||||||
})
|
})
|
||||||
|
|
||||||
private fetchedEnough(pullRequests: PullsListData, fromDate: moment.Moment): boolean {
|
private fetchedEnough(pullRequests: PullsListData, fromDate: moment.Moment): boolean {
|
||||||
for (let i = 0; i < Math.min(pullRequests.length, 3); i++) {
|
for (let i = 0; i < Math.min(pullRequests.length, 3); i++) {
|
||||||
const firstPR = pullRequests[i]
|
const firstPR = pullRequests[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user