Select Git revision
gitea-helper.ts 11.51 KiB
import { URLSearchParams } from 'url';
import { PR_STATE_CLOSED } from '../../constants/pull-requests';
import { BranchStatus } from '../../types';
import { GotResponse } from '../common';
import { GiteaGotOptions, api } from './gitea-got-wrapper';
export type PRState = 'open' | 'closed' | 'all';
export type IssueState = 'open' | 'closed' | 'all';
export type CommitStatusType =
| 'pending'
| 'success'
| 'error'
| 'failure'
| 'warning'
| 'unknown';
export type PRMergeMethod = 'merge' | 'rebase' | 'rebase-merge' | 'squash';
export interface PR {
number: number;
state: PRState;
title: string;
body: string;
mergeable: boolean;
created_at: string;
closed_at: string;
diff_url: string;
base?: {
ref: string;
};
head?: {
label: string;
sha: string;
repo?: Repo;
};
}
export interface Issue {
number: number;
state: IssueState;
title: string;
body: string;
assignees: User[];
}
export interface User {
id: number;
email: string;
full_name: string;
username: string;
}
export interface Repo {
allow_merge_commits: boolean;
allow_rebase: boolean;
allow_rebase_explicit: boolean;
allow_squash_merge: boolean;
archived: boolean;
clone_url: string;
default_branch: string;
empty: boolean;
fork: boolean;
full_name: string;
mirror: boolean;
owner: User;
permissions: RepoPermission;
}
export interface RepoPermission {
admin: boolean;
pull: boolean;