REST Resource: projects.locations.repositories.branchRules

Resource: BranchRule

Metadata of a BranchRule. BranchRule is the protection rule to enforce pre-defined rules on desginated branches within a repository.

JSON representation
{
  "name": string,
  "uid": string,
  "createTime": string,
  "updateTime": string,
  "annotations": {
    string: string,
    ...
  },
  "etag": string,
  "includePattern": string,
  "disabled": boolean,
  "requirePullRequest": boolean,
  "minimumReviewsCount": integer,
  "minimumApprovalsCount": integer,
  "requireCommentsResolved": boolean,
  "allowStaleReviews": boolean,
  "requireLinearHistory": boolean,
  "requiredStatusChecks": [
    {
      object (Check)
    }
  ]
}
Fields
name

string

Optional. A unique identifier for a BranchRule. The name should be of the format: projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branchRule}

uid

string

Output only. Unique identifier of the repository.

createTime

string (Timestamp format)

Output only. Create timestamp.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

updateTime

string (Timestamp format)

Output only. Update timestamp.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

annotations

map (key: string, value: string)

Optional. User annotations. These attributes can only be set and used by the user. See https://google.aip.dev/128#annotations for more details such as format and size limitations.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

etag

string

Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.

includePattern

string

Optional. The pattern of the branch that can match to this BranchRule. Specified as regex. .* for all branches. Examples: main, (main|release.*). Current MVP phase only support .* for wildcard.

disabled

boolean

Optional. Determines if the branch rule is disabled or not.

requirePullRequest

boolean

Optional. Determines if the branch rule requires a pull request or not.

minimumReviewsCount

integer

Optional. The minimum number of reviews required for the branch rule to be matched.

minimumApprovalsCount

integer

Optional. The minimum number of approvals required for the branch rule to be matched.

requireCommentsResolved

boolean

Optional. Determines if require comments resolved before merging to the branch.

allowStaleReviews

boolean

Optional. Determines if allow stale reviews or approvals before merging to the branch.

requireLinearHistory

boolean

Optional. Determines if require linear history before merging to the branch.

requiredStatusChecks[]

object (Check)

Optional. List of required status checks before merging to the branch.

Check

Check is a type for status check.

JSON representation
{
  "context": string
}
Fields
context

string

Required. The context of the check.

Methods

create

CreateBranchRule creates a branch rule in a given repository.

delete

DeleteBranchRule deletes a branch rule.

get

GetBranchRule gets a branch rule.

list

ListBranchRules lists branch rules in a given repository.

patch

UpdateBranchRule updates a branch rule.