Skip to main content

project_branch_rules

Gets or lists a project_branch_rules resource.

Overview​

Nameproject_branch_rules
TypeResource
Idgitlab.projects.project_branch_rules

Fields​

The following fields are returned by SELECT queries:

GraphQL response envelope

NameDatatypeDescription
idstringID of the branch rule.
namestringName of the branch rule target. Includes wildcards.
created_atstringTimestamp of when the branch rule was created.
is_defaultbooleanCheck if the branch rule protects the project's default branch.
is_protectedbooleanCheck if the branch rule protects access for the branch.
matching_branches_countintegerNumber of existing branches that match the branch rule.
updated_atstringTimestamp of when the branch rule was last updated.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectfull_path, hostbuild_missingBranch rules configured for the project. Generated from the GitLab GraphQL schema field Project.branchRules (connection of BranchRule nodes).

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
full_pathstringFull path of the project, for example gitlab-org/gitlab
hoststringGitLab host, with an optional port (default gitlab.com). Resolved from the GITLAB_HOST environment variable when it is set (x-stackQL-envVar); a WHERE host value always takes precedence. Self-managed instances: the provider is generated from the gitlab.com schema, so older instances may reject fields they do not serve. (default: gitlab.com, x-stackQL-envVar: GITLAB_HOST)
build_missingbooleanReturn unpersisted custom branch rules.

SELECT examples​

Branch rules configured for the project. Generated from the GitLab GraphQL schema field Project.branchRules (connection of BranchRule nodes).

SELECT
id,
name,
created_at,
is_default,
is_protected,
matching_branches_count,
updated_at
FROM gitlab.projects.project_branch_rules
WHERE full_path = '{{ full_path }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
AND build_missing = '{{ build_missing }}'
;