mirror of https://github.com/harness/drone.git
feat: [CODE-2370]: changes for using PR source branch delete/restore API (#2702)
* fixed error for branch not found * swagger.yaml prettier * removed commitSha queryParam and do a getBranch to get the commitSha * fixed lint issue * Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into CODE-2370-2 * added commit_sha query param to PR delete branch API * fixed linting issues * updated swagger * feat: [CODE-2370]: changes for using PR source branch delete/restore APICODE-2402
parent
4482527dbf
commit
8bc9714c92
|
@ -22,6 +22,7 @@ import (
|
||||||
"github.com/harness/gitness/app/api/usererror"
|
"github.com/harness/gitness/app/api/usererror"
|
||||||
"github.com/harness/gitness/app/auth"
|
"github.com/harness/gitness/app/auth"
|
||||||
"github.com/harness/gitness/app/services/protection"
|
"github.com/harness/gitness/app/services/protection"
|
||||||
|
"github.com/harness/gitness/errors"
|
||||||
"github.com/harness/gitness/git"
|
"github.com/harness/gitness/git"
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
"github.com/harness/gitness/types/enum"
|
"github.com/harness/gitness/types/enum"
|
||||||
|
@ -34,7 +35,7 @@ func (c *Controller) DeleteBranch(ctx context.Context,
|
||||||
session *auth.Session,
|
session *auth.Session,
|
||||||
repoRef string,
|
repoRef string,
|
||||||
pullreqNum int64,
|
pullreqNum int64,
|
||||||
bypassRules bool,
|
bypassRules,
|
||||||
dryRunRules bool,
|
dryRunRules bool,
|
||||||
) (types.DeleteBranchOutput, []types.RuleViolations, error) {
|
) (types.DeleteBranchOutput, []types.RuleViolations, error) {
|
||||||
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
|
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
|
||||||
|
@ -88,10 +89,32 @@ func (c *Controller) DeleteBranch(ctx context.Context,
|
||||||
return types.DeleteBranchOutput{}, nil, fmt.Errorf("failed to create RPC write params: %w", err)
|
return types.DeleteBranchOutput{}, nil, fmt.Errorf("failed to create RPC write params: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
branch, err := func() (types.Branch, error) {
|
||||||
|
rpcOut, err := c.git.GetBranch(ctx, &git.GetBranchParams{
|
||||||
|
ReadParams: git.CreateReadParams(repo),
|
||||||
|
BranchName: branchName,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return types.Branch{}, fmt.Errorf("failed to fetch source branch: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedBranch, err := controller.MapBranch(rpcOut.Branch)
|
||||||
|
if err != nil {
|
||||||
|
return types.Branch{}, fmt.Errorf("failed to map source branch: %w", err)
|
||||||
|
}
|
||||||
|
return mappedBranch, nil
|
||||||
|
}()
|
||||||
|
if err != nil {
|
||||||
|
return types.DeleteBranchOutput{}, nil, err
|
||||||
|
}
|
||||||
|
if pr.SourceSHA != branch.SHA {
|
||||||
|
return types.DeleteBranchOutput{}, nil, errors.Conflict("source branch SHA does not match pull request source SHA")
|
||||||
|
}
|
||||||
|
|
||||||
err = c.git.DeleteBranch(ctx, &git.DeleteBranchParams{
|
err = c.git.DeleteBranch(ctx, &git.DeleteBranchParams{
|
||||||
WriteParams: writeParams,
|
WriteParams: writeParams,
|
||||||
BranchName: branchName,
|
BranchName: branchName,
|
||||||
SHA: pr.SourceSHA,
|
SHA: branch.SHA,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.DeleteBranchOutput{}, nil, err
|
return types.DeleteBranchOutput{}, nil, err
|
||||||
|
@ -103,7 +126,7 @@ func (c *Controller) DeleteBranch(ctx context.Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := c.activityStore.CreateWithPayload(ctx, pr, session.Principal.ID,
|
_, err := c.activityStore.CreateWithPayload(ctx, pr, session.Principal.ID,
|
||||||
&types.PullRequestActivityPayloadBranchDelete{SHA: pr.SourceSHA}, nil)
|
&types.PullRequestActivityPayloadBranchDelete{SHA: branch.SHA}, nil)
|
||||||
return err
|
return err
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,9 +32,8 @@ func (c *Controller) DeleteBranch(ctx context.Context,
|
||||||
session *auth.Session,
|
session *auth.Session,
|
||||||
repoRef string,
|
repoRef string,
|
||||||
branchName string,
|
branchName string,
|
||||||
bypassRules bool,
|
bypassRules,
|
||||||
dryRunRules bool,
|
dryRunRules bool,
|
||||||
commitSha string,
|
|
||||||
) (types.DeleteBranchOutput, []types.RuleViolations, error) {
|
) (types.DeleteBranchOutput, []types.RuleViolations, error) {
|
||||||
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
|
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -88,7 +87,6 @@ func (c *Controller) DeleteBranch(ctx context.Context,
|
||||||
err = c.git.DeleteBranch(ctx, &git.DeleteBranchParams{
|
err = c.git.DeleteBranch(ctx, &git.DeleteBranchParams{
|
||||||
WriteParams: writeParams,
|
WriteParams: writeParams,
|
||||||
BranchName: branchName,
|
BranchName: branchName,
|
||||||
SHA: commitSha,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.DeleteBranchOutput{}, nil, err
|
return types.DeleteBranchOutput{}, nil, err
|
||||||
|
|
|
@ -52,9 +52,7 @@ func HandleDeleteBranch(repoCtrl *repo.Controller) http.HandlerFunc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
commitSha := request.GetCommitSHAFromQueryOrDefault(r)
|
out, violations, err := repoCtrl.DeleteBranch(ctx, session, repoRef, branchName, bypassRules, dryRunRules)
|
||||||
|
|
||||||
out, violations, err := repoCtrl.DeleteBranch(ctx, session, repoRef, branchName, bypassRules, dryRunRules, commitSha)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
render.TranslatedUserError(ctx, w, err)
|
render.TranslatedUserError(ctx, w, err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -542,20 +542,6 @@ var queryParameterDryRunRules = openapi3.ParameterOrRef{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var queryParameterCommitSHA = openapi3.ParameterOrRef{
|
|
||||||
Parameter: &openapi3.Parameter{
|
|
||||||
Name: request.QueryParamCommitSHA,
|
|
||||||
In: openapi3.ParameterInQuery,
|
|
||||||
Description: ptr.String("Commit SHA the branch is at"),
|
|
||||||
Required: ptr.Bool(false),
|
|
||||||
Schema: &openapi3.SchemaOrRef{
|
|
||||||
Schema: &openapi3.Schema{
|
|
||||||
Type: ptrSchemaType(openapi3.SchemaTypeString),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryParameterDeletedAt = openapi3.ParameterOrRef{
|
var queryParameterDeletedAt = openapi3.ParameterOrRef{
|
||||||
Parameter: &openapi3.Parameter{
|
Parameter: &openapi3.Parameter{
|
||||||
Name: request.QueryParamDeletedAt,
|
Name: request.QueryParamDeletedAt,
|
||||||
|
@ -936,7 +922,7 @@ func repoOperations(reflector *openapi3.Reflector) {
|
||||||
opDeleteBranch := openapi3.Operation{}
|
opDeleteBranch := openapi3.Operation{}
|
||||||
opDeleteBranch.WithTags("repository")
|
opDeleteBranch.WithTags("repository")
|
||||||
opDeleteBranch.WithMapOfAnything(map[string]interface{}{"operationId": "deleteBranch"})
|
opDeleteBranch.WithMapOfAnything(map[string]interface{}{"operationId": "deleteBranch"})
|
||||||
opDeleteBranch.WithParameters(queryParameterBypassRules, queryParameterDryRunRules, queryParameterCommitSHA)
|
opDeleteBranch.WithParameters(queryParameterBypassRules, queryParameterDryRunRules)
|
||||||
_ = reflector.SetRequest(&opDeleteBranch, new(deleteBranchRequest), http.MethodDelete)
|
_ = reflector.SetRequest(&opDeleteBranch, new(deleteBranchRequest), http.MethodDelete)
|
||||||
_ = reflector.SetJSONResponse(&opDeleteBranch, new(types.DeleteBranchOutput), http.StatusOK)
|
_ = reflector.SetJSONResponse(&opDeleteBranch, new(types.DeleteBranchOutput), http.StatusOK)
|
||||||
_ = reflector.SetJSONResponse(&opDeleteBranch, new(usererror.Error), http.StatusInternalServerError)
|
_ = reflector.SetJSONResponse(&opDeleteBranch, new(usererror.Error), http.StatusInternalServerError)
|
||||||
|
|
|
@ -34,6 +34,7 @@ export enum CommentType {
|
||||||
MERGE = 'merge',
|
MERGE = 'merge',
|
||||||
BRANCH_UPDATE = 'branch-update',
|
BRANCH_UPDATE = 'branch-update',
|
||||||
BRANCH_DELETE = 'branch-delete',
|
BRANCH_DELETE = 'branch-delete',
|
||||||
|
BRANCH_RESTORE = 'branch-restore',
|
||||||
STATE_CHANGE = 'state-change',
|
STATE_CHANGE = 'state-change',
|
||||||
LABEL_MODIFY = 'label-modify'
|
LABEL_MODIFY = 'label-modify'
|
||||||
}
|
}
|
||||||
|
|
|
@ -808,6 +808,7 @@ export interface StringsMap {
|
||||||
'pr.prBranchDeleteInfo': string
|
'pr.prBranchDeleteInfo': string
|
||||||
'pr.prBranchForcePushInfo': string
|
'pr.prBranchForcePushInfo': string
|
||||||
'pr.prBranchPushInfo': string
|
'pr.prBranchPushInfo': string
|
||||||
|
'pr.prBranchRestoreInfo': string
|
||||||
'pr.prCanBeMerged': string
|
'pr.prCanBeMerged': string
|
||||||
'pr.prClosed': string
|
'pr.prClosed': string
|
||||||
'pr.prMerged': string
|
'pr.prMerged': string
|
||||||
|
|
|
@ -321,6 +321,7 @@ pr:
|
||||||
prBranchPushInfo: '{user} pushed a new commit {commit}'
|
prBranchPushInfo: '{user} pushed a new commit {commit}'
|
||||||
prBranchForcePushInfo: '{user} force-pushed the {gitRef} branch from {oldCommit} to {newCommit}'
|
prBranchForcePushInfo: '{user} force-pushed the {gitRef} branch from {oldCommit} to {newCommit}'
|
||||||
prBranchDeleteInfo: '{user} deleted the source branch with latest commit {commit}'
|
prBranchDeleteInfo: '{user} deleted the source branch with latest commit {commit}'
|
||||||
|
prBranchRestoreInfo: '{user} restored the source branch with latest commit {commit}'
|
||||||
prStateChanged: '{user} changed pull request state from {old} to {new}.'
|
prStateChanged: '{user} changed pull request state from {old} to {new}.'
|
||||||
prStateChangedDraft: '{user} {changedToDraft|true:marked pull request as draft.,opened pull request for review.}'
|
prStateChangedDraft: '{user} {changedToDraft|true:marked pull request as draft.,opened pull request for review.}'
|
||||||
titleChanged: '{user} changed title from {old} to {new}.'
|
titleChanged: '{user} changed title from {old} to {new}.'
|
||||||
|
|
|
@ -38,7 +38,7 @@ import cx from 'classnames'
|
||||||
import ReactTimeago from 'react-timeago'
|
import ReactTimeago from 'react-timeago'
|
||||||
import type {
|
import type {
|
||||||
CreateBranchPathParams,
|
CreateBranchPathParams,
|
||||||
DeleteBranchQueryParams,
|
DeletePullReqSourceBranchQueryParams,
|
||||||
OpenapiCreateBranchRequest,
|
OpenapiCreateBranchRequest,
|
||||||
OpenapiStatePullReqRequest,
|
OpenapiStatePullReqRequest,
|
||||||
TypesListCommitResponse,
|
TypesListCommitResponse,
|
||||||
|
@ -77,7 +77,7 @@ export interface PullRequestActionsBoxProps extends Pick<GitInfoProps, 'repoMeta
|
||||||
refetchActivities: () => void
|
refetchActivities: () => void
|
||||||
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
||||||
refetchBranch: () => Promise<void>
|
refetchBranch: () => Promise<void>
|
||||||
deleteBranch: MutateMethod<any, any, DeleteBranchQueryParams, unknown>
|
deleteBranch: MutateMethod<any, any, DeletePullReqSourceBranchQueryParams, unknown>
|
||||||
showRestoreBranchButton: boolean
|
showRestoreBranchButton: boolean
|
||||||
showDeleteBranchButton: boolean
|
showDeleteBranchButton: boolean
|
||||||
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
|
@ -270,6 +270,7 @@ export const PullRequestActionsBox: React.FC<PullRequestActionsBoxProps> = ({
|
||||||
showDeleteBranchButton={showDeleteBranchButton}
|
showDeleteBranchButton={showDeleteBranchButton}
|
||||||
setShowDeleteBranchButton={setShowDeleteBranchButton}
|
setShowDeleteBranchButton={setShowDeleteBranchButton}
|
||||||
setShowRestoreBranchButton={setShowRestoreBranchButton}
|
setShowRestoreBranchButton={setShowRestoreBranchButton}
|
||||||
|
refetchActivities={refetchActivities}
|
||||||
refetchBranch={refetchBranch}
|
refetchBranch={refetchBranch}
|
||||||
createBranch={createBranch}
|
createBranch={createBranch}
|
||||||
deleteBranch={deleteBranch}
|
deleteBranch={deleteBranch}
|
||||||
|
@ -549,9 +550,10 @@ const MergeInfo: React.FC<{
|
||||||
showDeleteBranchButton: boolean
|
showDeleteBranchButton: boolean
|
||||||
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
setShowRestoreBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
setShowRestoreBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
|
refetchActivities: () => void
|
||||||
refetchBranch: () => Promise<void>
|
refetchBranch: () => Promise<void>
|
||||||
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
||||||
deleteBranch: MutateMethod<any, any, DeleteBranchQueryParams, unknown>
|
deleteBranch: MutateMethod<any, any, DeletePullReqSourceBranchQueryParams, unknown>
|
||||||
}> = props => {
|
}> = props => {
|
||||||
const { pullRequestMetadata, showRestoreBranchButton, showDeleteBranchButton } = props
|
const { pullRequestMetadata, showRestoreBranchButton, showDeleteBranchButton } = props
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
|
|
|
@ -19,6 +19,7 @@ import cx from 'classnames'
|
||||||
import { useGet, useMutate } from 'restful-react'
|
import { useGet, useMutate } from 'restful-react'
|
||||||
import { Render } from 'react-jsx-match'
|
import { Render } from 'react-jsx-match'
|
||||||
import type {
|
import type {
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
TypesCodeOwnerEvaluation,
|
TypesCodeOwnerEvaluation,
|
||||||
TypesListCommitResponse,
|
TypesListCommitResponse,
|
||||||
TypesPullReq,
|
TypesPullReq,
|
||||||
|
@ -26,8 +27,7 @@ import type {
|
||||||
TypesPullReqReviewer,
|
TypesPullReqReviewer,
|
||||||
RepoRepositoryOutput,
|
RepoRepositoryOutput,
|
||||||
TypesRuleViolations,
|
TypesRuleViolations,
|
||||||
TypesBranch,
|
TypesBranch
|
||||||
DeleteBranchQueryParams
|
|
||||||
} from 'services/code'
|
} from 'services/code'
|
||||||
import {
|
import {
|
||||||
PanelSectionOutletPosition,
|
PanelSectionOutletPosition,
|
||||||
|
@ -132,13 +132,12 @@ const PullRequestOverviewPanel = (props: PullRequestOverviewPanelProps) => {
|
||||||
})
|
})
|
||||||
const { mutate: deleteBranch } = useMutate({
|
const { mutate: deleteBranch } = useMutate({
|
||||||
verb: 'DELETE',
|
verb: 'DELETE',
|
||||||
path: `/api/v1/repos/${repoMetadata.path}/+/branches/${pullReqMetadata.source_branch}`,
|
path: `/api/v1/repos/${repoMetadata.path}/+/pullreq/${pullReqMetadata.number}/branch`,
|
||||||
queryParams: { bypass_rules: true, dry_run_rules: true } as DeleteBranchQueryParams
|
queryParams: { bypass_rules: true, dry_run_rules: true } as DeletePullReqSourceBranchQueryParams
|
||||||
})
|
})
|
||||||
const { mutate: createBranch } = useMutate({
|
const { mutate: createBranch } = useMutate({
|
||||||
verb: 'POST',
|
verb: 'POST',
|
||||||
path: `/api/v1/repos/${repoMetadata.path}/+/branches`,
|
path: `/api/v1/repos/${repoMetadata.path}/+/pullreq/${pullReqMetadata.number}/branch`
|
||||||
pathParams: { repo_ref: repoMetadata.path }
|
|
||||||
})
|
})
|
||||||
const { mutate: mergePR, loading: mergeLoading } = useMutate({
|
const { mutate: mergePR, loading: mergeLoading } = useMutate({
|
||||||
verb: 'POST',
|
verb: 'POST',
|
||||||
|
@ -325,6 +324,7 @@ const PullRequestOverviewPanel = (props: PullRequestOverviewPanelProps) => {
|
||||||
sourceBranch={sourceBranch?.name || pullReqMetadata.source_branch || ''}
|
sourceBranch={sourceBranch?.name || pullReqMetadata.source_branch || ''}
|
||||||
createBranch={createBranch}
|
createBranch={createBranch}
|
||||||
refetchBranch={refetchBranch}
|
refetchBranch={refetchBranch}
|
||||||
|
refetchActivities={refetchActivities}
|
||||||
deleteBranch={deleteBranch}
|
deleteBranch={deleteBranch}
|
||||||
showDeleteBranchButton={showDeleteBranchButton}
|
showDeleteBranchButton={showDeleteBranchButton}
|
||||||
setShowRestoreBranchButton={setShowRestoreBranchButton}
|
setShowRestoreBranchButton={setShowRestoreBranchButton}
|
||||||
|
|
|
@ -21,15 +21,20 @@ import { Icon } from '@harnessio/icons'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import { CodeIcon } from 'utils/GitUtils'
|
import { CodeIcon } from 'utils/GitUtils'
|
||||||
import { getErrorMessage } from 'utils/Utils'
|
import { getErrorMessage } from 'utils/Utils'
|
||||||
import type { CreateBranchPathParams, DeleteBranchQueryParams, OpenapiCreateBranchRequest } from 'services/code'
|
import type {
|
||||||
|
CreateBranchPathParams,
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
|
OpenapiCreateBranchRequest
|
||||||
|
} from 'services/code'
|
||||||
import css from '../PullRequestOverviewPanel.module.scss'
|
import css from '../PullRequestOverviewPanel.module.scss'
|
||||||
|
|
||||||
interface BranchActionsSectionProps {
|
interface BranchActionsSectionProps {
|
||||||
sourceSha: string
|
sourceSha: string
|
||||||
sourceBranch: string
|
sourceBranch: string
|
||||||
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
createBranch: MutateMethod<any, any, OpenapiCreateBranchRequest, CreateBranchPathParams>
|
||||||
|
refetchActivities: () => void
|
||||||
refetchBranch: () => Promise<void>
|
refetchBranch: () => Promise<void>
|
||||||
deleteBranch: MutateMethod<any, any, DeleteBranchQueryParams, unknown>
|
deleteBranch: MutateMethod<any, any, DeletePullReqSourceBranchQueryParams, unknown>
|
||||||
showDeleteBranchButton: boolean
|
showDeleteBranchButton: boolean
|
||||||
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
setShowDeleteBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
setShowRestoreBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
setShowRestoreBranchButton: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
|
@ -69,6 +74,7 @@ export const BranchActionsButton = ({
|
||||||
sourceSha,
|
sourceSha,
|
||||||
sourceBranch,
|
sourceBranch,
|
||||||
createBranch,
|
createBranch,
|
||||||
|
refetchActivities,
|
||||||
refetchBranch,
|
refetchBranch,
|
||||||
deleteBranch,
|
deleteBranch,
|
||||||
showDeleteBranchButton,
|
showDeleteBranchButton,
|
||||||
|
@ -85,11 +91,12 @@ export const BranchActionsButton = ({
|
||||||
variation={ButtonVariation.SECONDARY}
|
variation={ButtonVariation.SECONDARY}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
showDeleteBranchButton
|
showDeleteBranchButton
|
||||||
? deleteBranch({}, { queryParams: { bypass_rules: true, dry_run_rules: false, commit_sha: sourceSha } })
|
? deleteBranch({}, { queryParams: { bypass_rules: true, dry_run_rules: false } })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
refetchBranch()
|
refetchBranch()
|
||||||
setIsSourceBranchDeleted?.(true)
|
setIsSourceBranchDeleted?.(true)
|
||||||
setShowDeleteBranchButton(false)
|
setShowDeleteBranchButton(false)
|
||||||
|
refetchActivities()
|
||||||
showSuccess(
|
showSuccess(
|
||||||
<StringSubstitute
|
<StringSubstitute
|
||||||
str={getString('branchDeleted')}
|
str={getString('branchDeleted')}
|
||||||
|
@ -106,6 +113,7 @@ export const BranchActionsButton = ({
|
||||||
refetchBranch()
|
refetchBranch()
|
||||||
setIsSourceBranchDeleted?.(false)
|
setIsSourceBranchDeleted?.(false)
|
||||||
setShowRestoreBranchButton(false)
|
setShowRestoreBranchButton(false)
|
||||||
|
refetchActivities()
|
||||||
showSuccess(
|
showSuccess(
|
||||||
<StringSubstitute
|
<StringSubstitute
|
||||||
str={getString('branchRestored')}
|
str={getString('branchRestored')}
|
||||||
|
|
|
@ -241,14 +241,16 @@ export const SystemComment: React.FC<SystemCommentProps> = ({ pullReqMetadata, c
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
case CommentType.BRANCH_DELETE: {
|
case CommentType.BRANCH_DELETE:
|
||||||
|
case CommentType.BRANCH_RESTORE: {
|
||||||
|
const isSourceBranchDeleted = type === CommentType.BRANCH_DELETE
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Layout.Horizontal spacing="small" style={{ alignItems: 'center' }} className={css.mergedBox}>
|
<Layout.Horizontal spacing="small" style={{ alignItems: 'center' }} className={css.mergedBox}>
|
||||||
<Avatar name={payload?.author?.display_name} size="small" hoverCard={false} />
|
<Avatar name={payload?.author?.display_name} size="small" hoverCard={false} />
|
||||||
<Text flex tag="div">
|
<Text flex tag="div">
|
||||||
<StringSubstitute
|
<StringSubstitute
|
||||||
str={getString('pr.prBranchDeleteInfo')}
|
str={isSourceBranchDeleted ? getString('pr.prBranchDeleteInfo') : getString('pr.prBranchRestoreInfo')}
|
||||||
vars={{
|
vars={{
|
||||||
user: (
|
user: (
|
||||||
<Text padding={{ right: 'small' }} inline>
|
<Text padding={{ right: 'small' }} inline>
|
||||||
|
|
|
@ -26,6 +26,12 @@ export type EnumCheckPayloadKind = '' | 'markdown' | 'pipeline' | 'raw'
|
||||||
|
|
||||||
export type EnumCheckStatus = 'error' | 'failure' | 'pending' | 'running' | 'success'
|
export type EnumCheckStatus = 'error' | 'failure' | 'pending' | 'running' | 'success'
|
||||||
|
|
||||||
|
export type EnumConnectorAuthType = 'basic' | 'bearer'
|
||||||
|
|
||||||
|
export type EnumConnectorStatus = 'failed' | 'success'
|
||||||
|
|
||||||
|
export type EnumConnectorType = 'github'
|
||||||
|
|
||||||
export type EnumContentEncodingType = 'base64' | 'utf8'
|
export type EnumContentEncodingType = 'base64' | 'utf8'
|
||||||
|
|
||||||
export type EnumFileDiffStatus = string
|
export type EnumFileDiffStatus = string
|
||||||
|
@ -122,6 +128,7 @@ export type EnumPullReqActivityKind = 'change-comment' | 'comment' | 'system'
|
||||||
|
|
||||||
export type EnumPullReqActivityType =
|
export type EnumPullReqActivityType =
|
||||||
| 'branch-delete'
|
| 'branch-delete'
|
||||||
|
| 'branch-restore'
|
||||||
| 'branch-update'
|
| 'branch-update'
|
||||||
| 'code-comment'
|
| 'code-comment'
|
||||||
| 'comment'
|
| 'comment'
|
||||||
|
@ -353,12 +360,11 @@ export interface OpenapiCreateBranchRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenapiCreateConnectorRequest {
|
export interface OpenapiCreateConnectorRequest {
|
||||||
data?: string
|
|
||||||
description?: string
|
description?: string
|
||||||
|
github?: TypesGithubConnectorData
|
||||||
identifier?: string
|
identifier?: string
|
||||||
space_ref?: string
|
space_ref?: string
|
||||||
type?: string
|
type?: EnumConnectorType
|
||||||
uid?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenapiCreateGitspaceRequest {
|
export interface OpenapiCreateGitspaceRequest {
|
||||||
|
@ -614,10 +620,8 @@ export interface OpenapiUpdateAdminRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenapiUpdateConnectorRequest {
|
export interface OpenapiUpdateConnectorRequest {
|
||||||
data?: string | null
|
|
||||||
description?: string | null
|
description?: string | null
|
||||||
identifier?: string | null
|
identifier?: string | null
|
||||||
uid?: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenapiUpdateDefaultBranchRequest {
|
export interface OpenapiUpdateDefaultBranchRequest {
|
||||||
|
@ -734,9 +738,11 @@ export interface ProtectionDefLifecycle {
|
||||||
create_forbidden?: boolean
|
create_forbidden?: boolean
|
||||||
delete_forbidden?: boolean
|
delete_forbidden?: boolean
|
||||||
update_forbidden?: boolean
|
update_forbidden?: boolean
|
||||||
|
update_force_forbidden?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProtectionDefMerge {
|
export interface ProtectionDefMerge {
|
||||||
|
block?: boolean
|
||||||
delete_branch?: boolean
|
delete_branch?: boolean
|
||||||
strategies_allowed?: EnumMergeMethod[]
|
strategies_allowed?: EnumMergeMethod[]
|
||||||
}
|
}
|
||||||
|
@ -927,6 +933,15 @@ export interface SystemConfigOutput {
|
||||||
|
|
||||||
export type TimeDuration = number | null
|
export type TimeDuration = number | null
|
||||||
|
|
||||||
|
export interface TypesBasicAuthCreds {
|
||||||
|
password?: TypesSecretRef
|
||||||
|
username?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypesBearerTokenCreds {
|
||||||
|
token?: TypesSecretRef
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesBranch {
|
export interface TypesBranch {
|
||||||
commit?: TypesCommit
|
commit?: TypesCommit
|
||||||
name?: string
|
name?: string
|
||||||
|
@ -1015,14 +1030,29 @@ export interface TypesCommitStats {
|
||||||
|
|
||||||
export interface TypesConnector {
|
export interface TypesConnector {
|
||||||
created?: number
|
created?: number
|
||||||
data?: string
|
created_by?: number
|
||||||
description?: string
|
description?: string
|
||||||
|
github?: TypesGithubConnectorData
|
||||||
identifier?: string
|
identifier?: string
|
||||||
|
last_test_attempt?: number
|
||||||
|
last_test_error_msg?: string
|
||||||
|
last_test_status?: EnumConnectorStatus
|
||||||
space_id?: number
|
space_id?: number
|
||||||
type?: string
|
type?: EnumConnectorType
|
||||||
updated?: number
|
updated?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TypesConnectorAuth = {
|
||||||
|
basic?: TypesBasicAuthCreds
|
||||||
|
bearer?: TypesBearerTokenCreds
|
||||||
|
type?: EnumConnectorAuthType
|
||||||
|
} | null
|
||||||
|
|
||||||
|
export interface TypesConnectorTestResponse {
|
||||||
|
error_msg?: string
|
||||||
|
status?: EnumConnectorStatus
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesCreateBranchOutput {
|
export interface TypesCreateBranchOutput {
|
||||||
commit?: TypesCommit
|
commit?: TypesCommit
|
||||||
dry_run_rules?: boolean
|
dry_run_rules?: boolean
|
||||||
|
@ -1083,6 +1113,12 @@ export interface TypesExecution {
|
||||||
updated?: number
|
updated?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesGithubConnectorData {
|
||||||
|
api_url?: string
|
||||||
|
auth?: TypesConnectorAuth
|
||||||
|
insecure?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesGitspaceConfig {
|
export interface TypesGitspaceConfig {
|
||||||
branch?: string
|
branch?: string
|
||||||
code_repo_is_private?: boolean
|
code_repo_is_private?: boolean
|
||||||
|
@ -1347,6 +1383,7 @@ export interface TypesPullReq {
|
||||||
target_branch?: string
|
target_branch?: string
|
||||||
target_repo_id?: number
|
target_repo_id?: number
|
||||||
title?: string
|
title?: string
|
||||||
|
updated?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TypesPullReqActivity {
|
export interface TypesPullReqActivity {
|
||||||
|
@ -1543,6 +1580,10 @@ export interface TypesSecret {
|
||||||
updated?: number
|
updated?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesSecretRef {
|
||||||
|
identifier?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesServiceAccount {
|
export interface TypesServiceAccount {
|
||||||
admin?: boolean
|
admin?: boolean
|
||||||
blocked?: boolean
|
blocked?: boolean
|
||||||
|
@ -2839,10 +2880,6 @@ export interface DeleteBranchQueryParams {
|
||||||
* Dry run rules for operations
|
* Dry run rules for operations
|
||||||
*/
|
*/
|
||||||
dry_run_rules?: boolean
|
dry_run_rules?: boolean
|
||||||
/**
|
|
||||||
* Commit SHA the branch is at
|
|
||||||
*/
|
|
||||||
commit_sha?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteBranchPathParams {
|
export interface DeleteBranchPathParams {
|
||||||
|
@ -4773,13 +4810,13 @@ export interface ListPullReqQueryParams {
|
||||||
*/
|
*/
|
||||||
created_gt?: number
|
created_gt?: number
|
||||||
/**
|
/**
|
||||||
* The result should contain only entries edited before this timestamp (unix millis).
|
* The result should contain only entries updated before this timestamp (unix millis).
|
||||||
*/
|
*/
|
||||||
edited_lt?: number
|
updated_lt?: number
|
||||||
/**
|
/**
|
||||||
* The result should contain only entries edited after this timestamp (unix millis).
|
* The result should contain only entries updated after this timestamp (unix millis).
|
||||||
*/
|
*/
|
||||||
edited_gt?: number
|
updated_gt?: number
|
||||||
/**
|
/**
|
||||||
* By providing this parameter the description would be included in the response.
|
* By providing this parameter the description would be included in the response.
|
||||||
*/
|
*/
|
||||||
|
@ -4952,6 +4989,7 @@ export interface ListPullReqActivitiesQueryParams {
|
||||||
*/
|
*/
|
||||||
type?: (
|
type?: (
|
||||||
| 'branch-delete'
|
| 'branch-delete'
|
||||||
|
| 'branch-restore'
|
||||||
| 'branch-update'
|
| 'branch-update'
|
||||||
| 'code-comment'
|
| 'code-comment'
|
||||||
| 'comment'
|
| 'comment'
|
||||||
|
@ -5013,6 +5051,146 @@ export const useListPullReqActivities = ({ repo_ref, pullreq_number, ...props }:
|
||||||
{ base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props }
|
{ base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export interface DeletePullReqSourceBranchQueryParams {
|
||||||
|
/**
|
||||||
|
* Bypass rule violations if possible.
|
||||||
|
*/
|
||||||
|
bypass_rules?: boolean
|
||||||
|
/**
|
||||||
|
* Dry run rules for operations
|
||||||
|
*/
|
||||||
|
dry_run_rules?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeletePullReqSourceBranchPathParams {
|
||||||
|
repo_ref: string
|
||||||
|
pullreq_number: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DeletePullReqSourceBranchProps = Omit<
|
||||||
|
MutateProps<
|
||||||
|
TypesDeleteBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
|
void,
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
|
||||||
|
export const DeletePullReqSourceBranch = ({ repo_ref, pullreq_number, ...props }: DeletePullReqSourceBranchProps) => (
|
||||||
|
<Mutate<
|
||||||
|
TypesDeleteBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
|
void,
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
>
|
||||||
|
verb="DELETE"
|
||||||
|
path={`/repos/${repo_ref}/pullreq/${pullreq_number}/branch`}
|
||||||
|
base={getConfig('code/api/v1')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseDeletePullReqSourceBranchProps = Omit<
|
||||||
|
UseMutateProps<
|
||||||
|
TypesDeleteBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
|
void,
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
|
||||||
|
export const useDeletePullReqSourceBranch = ({
|
||||||
|
repo_ref,
|
||||||
|
pullreq_number,
|
||||||
|
...props
|
||||||
|
}: UseDeletePullReqSourceBranchProps) =>
|
||||||
|
useMutate<
|
||||||
|
TypesDeleteBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
DeletePullReqSourceBranchQueryParams,
|
||||||
|
void,
|
||||||
|
DeletePullReqSourceBranchPathParams
|
||||||
|
>(
|
||||||
|
'DELETE',
|
||||||
|
(paramsInPath: DeletePullReqSourceBranchPathParams) =>
|
||||||
|
`/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/branch`,
|
||||||
|
{ base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface RestorePullReqSourceBranchPathParams {
|
||||||
|
repo_ref: string
|
||||||
|
pullreq_number: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestorePullReqSourceBranchRequestBody {
|
||||||
|
bypass_rules?: boolean
|
||||||
|
dry_run_rules?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RestorePullReqSourceBranchProps = Omit<
|
||||||
|
MutateProps<
|
||||||
|
TypesCreateBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
void,
|
||||||
|
RestorePullReqSourceBranchRequestBody,
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
|
||||||
|
export const RestorePullReqSourceBranch = ({ repo_ref, pullreq_number, ...props }: RestorePullReqSourceBranchProps) => (
|
||||||
|
<Mutate<
|
||||||
|
TypesCreateBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
void,
|
||||||
|
RestorePullReqSourceBranchRequestBody,
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
>
|
||||||
|
verb="POST"
|
||||||
|
path={`/repos/${repo_ref}/pullreq/${pullreq_number}/branch`}
|
||||||
|
base={getConfig('code/api/v1')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseRestorePullReqSourceBranchProps = Omit<
|
||||||
|
UseMutateProps<
|
||||||
|
TypesCreateBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
void,
|
||||||
|
RestorePullReqSourceBranchRequestBody,
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
|
||||||
|
export const useRestorePullReqSourceBranch = ({
|
||||||
|
repo_ref,
|
||||||
|
pullreq_number,
|
||||||
|
...props
|
||||||
|
}: UseRestorePullReqSourceBranchProps) =>
|
||||||
|
useMutate<
|
||||||
|
TypesCreateBranchOutput,
|
||||||
|
UsererrorError | TypesRulesViolations,
|
||||||
|
void,
|
||||||
|
RestorePullReqSourceBranchRequestBody,
|
||||||
|
RestorePullReqSourceBranchPathParams
|
||||||
|
>(
|
||||||
|
'POST',
|
||||||
|
(paramsInPath: RestorePullReqSourceBranchPathParams) =>
|
||||||
|
`/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/branch`,
|
||||||
|
{ base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
export interface ChecksPullReqPathParams {
|
export interface ChecksPullReqPathParams {
|
||||||
repo_ref: string
|
repo_ref: string
|
||||||
pullreq_number: number
|
pullreq_number: number
|
||||||
|
@ -7321,9 +7499,9 @@ export interface ListSpacePullReqQueryParams {
|
||||||
*/
|
*/
|
||||||
created_gt?: number
|
created_gt?: number
|
||||||
/**
|
/**
|
||||||
* The result should contain only entries edited before this timestamp (unix millis).
|
* The result should contain only entries updated before this timestamp (unix millis).
|
||||||
*/
|
*/
|
||||||
edited_lt?: number
|
updated_lt?: number
|
||||||
/**
|
/**
|
||||||
* By providing this parameter the description would be included in the response.
|
* By providing this parameter the description would be included in the response.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1602,12 +1602,6 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
- description: Commit SHA the branch is at
|
|
||||||
in: query
|
|
||||||
name: commit_sha
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
- in: path
|
- in: path
|
||||||
name: repo_ref
|
name: repo_ref
|
||||||
required: true
|
required: true
|
||||||
|
@ -4332,18 +4326,18 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
minimum: 0
|
minimum: 0
|
||||||
type: integer
|
type: integer
|
||||||
- description: The result should contain only entries edited before this timestamp
|
- description: The result should contain only entries updated before this timestamp
|
||||||
(unix millis).
|
(unix millis).
|
||||||
in: query
|
in: query
|
||||||
name: edited_lt
|
name: updated_lt
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
minimum: 0
|
minimum: 0
|
||||||
type: integer
|
type: integer
|
||||||
- description: The result should contain only entries edited after this timestamp
|
- description: The result should contain only entries updated after this timestamp
|
||||||
(unix millis).
|
(unix millis).
|
||||||
in: query
|
in: query
|
||||||
name: edited_gt
|
name: updated_gt
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
minimum: 0
|
minimum: 0
|
||||||
|
@ -4643,6 +4637,7 @@ paths:
|
||||||
items:
|
items:
|
||||||
enum:
|
enum:
|
||||||
- branch-delete
|
- branch-delete
|
||||||
|
- branch-restore
|
||||||
- branch-update
|
- branch-update
|
||||||
- code-comment
|
- code-comment
|
||||||
- comment
|
- comment
|
||||||
|
@ -4724,6 +4719,135 @@ paths:
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
tags:
|
tags:
|
||||||
- pullreq
|
- pullreq
|
||||||
|
/repos/{repo_ref}/pullreq/{pullreq_number}/branch:
|
||||||
|
delete:
|
||||||
|
operationId: deletePullReqSourceBranch
|
||||||
|
parameters:
|
||||||
|
- description: Bypass rule violations if possible.
|
||||||
|
in: query
|
||||||
|
name: bypass_rules
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
- description: Dry run rules for operations
|
||||||
|
in: query
|
||||||
|
name: dry_run_rules
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
- in: path
|
||||||
|
name: repo_ref
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: pullreq_number
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TypesDeleteBranchOutput'
|
||||||
|
description: OK
|
||||||
|
'401':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Unauthorized
|
||||||
|
'403':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Forbidden
|
||||||
|
'404':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Not Found
|
||||||
|
'422':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TypesRulesViolations'
|
||||||
|
description: Unprocessable Entity
|
||||||
|
'500':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- pullreq
|
||||||
|
post:
|
||||||
|
operationId: restorePullReqSourceBranch
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: repo_ref
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: pullreq_number
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
bypass_rules:
|
||||||
|
type: boolean
|
||||||
|
dry_run_rules:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TypesCreateBranchOutput'
|
||||||
|
description: Created
|
||||||
|
'400':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Bad Request
|
||||||
|
'401':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Unauthorized
|
||||||
|
'403':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Forbidden
|
||||||
|
'422':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TypesRulesViolations'
|
||||||
|
description: Unprocessable Entity
|
||||||
|
'500':
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UsererrorError'
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- pullreq
|
||||||
/repos/{repo_ref}/pullreq/{pullreq_number}/checks:
|
/repos/{repo_ref}/pullreq/{pullreq_number}/checks:
|
||||||
get:
|
get:
|
||||||
operationId: checksPullReq
|
operationId: checksPullReq
|
||||||
|
@ -7940,10 +8064,10 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
minimum: 0
|
minimum: 0
|
||||||
type: integer
|
type: integer
|
||||||
- description: The result should contain only entries edited before this timestamp
|
- description: The result should contain only entries updated before this timestamp
|
||||||
(unix millis).
|
(unix millis).
|
||||||
in: query
|
in: query
|
||||||
name: edited_lt
|
name: updated_lt
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
minimum: 0
|
minimum: 0
|
||||||
|
@ -10258,6 +10382,20 @@ components:
|
||||||
- running
|
- running
|
||||||
- success
|
- success
|
||||||
type: string
|
type: string
|
||||||
|
EnumConnectorAuthType:
|
||||||
|
enum:
|
||||||
|
- basic
|
||||||
|
- bearer
|
||||||
|
type: string
|
||||||
|
EnumConnectorStatus:
|
||||||
|
enum:
|
||||||
|
- failed
|
||||||
|
- success
|
||||||
|
type: string
|
||||||
|
EnumConnectorType:
|
||||||
|
enum:
|
||||||
|
- github
|
||||||
|
type: string
|
||||||
EnumContentEncodingType:
|
EnumContentEncodingType:
|
||||||
enum:
|
enum:
|
||||||
- base64
|
- base64
|
||||||
|
@ -10417,6 +10555,7 @@ components:
|
||||||
EnumPullReqActivityType:
|
EnumPullReqActivityType:
|
||||||
enum:
|
enum:
|
||||||
- branch-delete
|
- branch-delete
|
||||||
|
- branch-restore
|
||||||
- branch-update
|
- branch-update
|
||||||
- code-comment
|
- code-comment
|
||||||
- comment
|
- comment
|
||||||
|
@ -10842,19 +10981,16 @@ components:
|
||||||
type: object
|
type: object
|
||||||
OpenapiCreateConnectorRequest:
|
OpenapiCreateConnectorRequest:
|
||||||
properties:
|
properties:
|
||||||
data:
|
|
||||||
type: string
|
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
github:
|
||||||
|
$ref: '#/components/schemas/TypesGithubConnectorData'
|
||||||
identifier:
|
identifier:
|
||||||
type: string
|
type: string
|
||||||
space_ref:
|
space_ref:
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
type: string
|
$ref: '#/components/schemas/EnumConnectorType'
|
||||||
uid:
|
|
||||||
deprecated: true
|
|
||||||
type: string
|
|
||||||
type: object
|
type: object
|
||||||
OpenapiCreateGitspaceRequest:
|
OpenapiCreateGitspaceRequest:
|
||||||
properties:
|
properties:
|
||||||
|
@ -11299,19 +11435,12 @@ components:
|
||||||
type: object
|
type: object
|
||||||
OpenapiUpdateConnectorRequest:
|
OpenapiUpdateConnectorRequest:
|
||||||
properties:
|
properties:
|
||||||
data:
|
|
||||||
nullable: true
|
|
||||||
type: string
|
|
||||||
description:
|
description:
|
||||||
nullable: true
|
nullable: true
|
||||||
type: string
|
type: string
|
||||||
identifier:
|
identifier:
|
||||||
nullable: true
|
nullable: true
|
||||||
type: string
|
type: string
|
||||||
uid:
|
|
||||||
deprecated: true
|
|
||||||
nullable: true
|
|
||||||
type: string
|
|
||||||
type: object
|
type: object
|
||||||
OpenapiUpdateDefaultBranchRequest:
|
OpenapiUpdateDefaultBranchRequest:
|
||||||
properties:
|
properties:
|
||||||
|
@ -11539,9 +11668,13 @@ components:
|
||||||
type: boolean
|
type: boolean
|
||||||
update_forbidden:
|
update_forbidden:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
update_force_forbidden:
|
||||||
|
type: boolean
|
||||||
type: object
|
type: object
|
||||||
ProtectionDefMerge:
|
ProtectionDefMerge:
|
||||||
properties:
|
properties:
|
||||||
|
block:
|
||||||
|
type: boolean
|
||||||
delete_branch:
|
delete_branch:
|
||||||
type: boolean
|
type: boolean
|
||||||
strategies_allowed:
|
strategies_allowed:
|
||||||
|
@ -11859,6 +11992,18 @@ components:
|
||||||
TimeDuration:
|
TimeDuration:
|
||||||
nullable: true
|
nullable: true
|
||||||
type: integer
|
type: integer
|
||||||
|
TypesBasicAuthCreds:
|
||||||
|
properties:
|
||||||
|
password:
|
||||||
|
$ref: '#/components/schemas/TypesSecretRef'
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
TypesBearerTokenCreds:
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
$ref: '#/components/schemas/TypesSecretRef'
|
||||||
|
type: object
|
||||||
TypesBranch:
|
TypesBranch:
|
||||||
properties:
|
properties:
|
||||||
commit:
|
commit:
|
||||||
|
@ -12015,19 +12160,44 @@ components:
|
||||||
properties:
|
properties:
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
data:
|
created_by:
|
||||||
type: string
|
type: integer
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
github:
|
||||||
|
$ref: '#/components/schemas/TypesGithubConnectorData'
|
||||||
identifier:
|
identifier:
|
||||||
type: string
|
type: string
|
||||||
|
last_test_attempt:
|
||||||
|
type: integer
|
||||||
|
last_test_error_msg:
|
||||||
|
type: string
|
||||||
|
last_test_status:
|
||||||
|
$ref: '#/components/schemas/EnumConnectorStatus'
|
||||||
space_id:
|
space_id:
|
||||||
type: integer
|
type: integer
|
||||||
type:
|
type:
|
||||||
type: string
|
$ref: '#/components/schemas/EnumConnectorType'
|
||||||
updated:
|
updated:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
TypesConnectorAuth:
|
||||||
|
nullable: true
|
||||||
|
properties:
|
||||||
|
basic:
|
||||||
|
$ref: '#/components/schemas/TypesBasicAuthCreds'
|
||||||
|
bearer:
|
||||||
|
$ref: '#/components/schemas/TypesBearerTokenCreds'
|
||||||
|
type:
|
||||||
|
$ref: '#/components/schemas/EnumConnectorAuthType'
|
||||||
|
type: object
|
||||||
|
TypesConnectorTestResponse:
|
||||||
|
properties:
|
||||||
|
error_msg:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
$ref: '#/components/schemas/EnumConnectorStatus'
|
||||||
|
type: object
|
||||||
TypesCreateBranchOutput:
|
TypesCreateBranchOutput:
|
||||||
properties:
|
properties:
|
||||||
commit:
|
commit:
|
||||||
|
@ -12144,6 +12314,15 @@ components:
|
||||||
updated:
|
updated:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
TypesGithubConnectorData:
|
||||||
|
properties:
|
||||||
|
api_url:
|
||||||
|
type: string
|
||||||
|
auth:
|
||||||
|
$ref: '#/components/schemas/TypesConnectorAuth'
|
||||||
|
insecure:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
TypesGitspaceConfig:
|
TypesGitspaceConfig:
|
||||||
properties:
|
properties:
|
||||||
branch:
|
branch:
|
||||||
|
@ -12658,6 +12837,8 @@ components:
|
||||||
type: integer
|
type: integer
|
||||||
title:
|
title:
|
||||||
type: string
|
type: string
|
||||||
|
updated:
|
||||||
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
TypesPullReqActivity:
|
TypesPullReqActivity:
|
||||||
properties:
|
properties:
|
||||||
|
@ -13004,6 +13185,11 @@ components:
|
||||||
updated:
|
updated:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
TypesSecretRef:
|
||||||
|
properties:
|
||||||
|
identifier:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
TypesServiceAccount:
|
TypesServiceAccount:
|
||||||
properties:
|
properties:
|
||||||
admin:
|
admin:
|
||||||
|
|
Loading…
Reference in New Issue