public sealed class PullRequestFilter : IMessage<PullRequestFilter>, IEquatable<PullRequestFilter>, IDeepCloneable<PullRequestFilter>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Build v1 API class PullRequestFilter.
PullRequestFilter contains filter properties for matching GitHub Pull
Requests.
public PullRequestFilter.Types.CommentControl CommentControl { get; set; }
If CommentControl is enabled, depending on the setting, builds may not
fire until a repository writer comments /gcbrun on a pull
request or /gcbrun is in the pull request description.
Only PR comments that contain /gcbrun will trigger builds.
If CommentControl is set to disabled, comments with /gcbrun from a user
with repository write permission or above will
still trigger builds to run.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-19 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePullRequestFilter\u003c/code\u003e class in the Cloud Build v1 API allows for defining criteria to match GitHub pull requests, which is detailed within the provided documentation for the class.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003ePullRequestFilter\u003c/code\u003e is 2.15.0, with historical versions dating back to 1.0.0, all available for reference.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePullRequestFilter\u003c/code\u003e class allows you to filter by branches using regular expressions (\u003ccode\u003eBranch\u003c/code\u003e) and also invert that regex matching (\u003ccode\u003eInvertRegex\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003ePullRequestFilter\u003c/code\u003e has a \u003ccode\u003eCommentControl\u003c/code\u003e property that can be enabled to control whether builds can be triggered by pull request comments such as "/gcbrun".\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGitRefCase\u003c/code\u003e property within the \u003ccode\u003ePullRequestFilter\u003c/code\u003e class is used to identify the type of Git reference being used.\u003c/p\u003e\n"]]],[],null,["# Cloud Build v1 API - Class PullRequestFilter (2.16.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.16.0 (latest)](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/latest/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.15.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.15.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.14.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.14.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.13.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.13.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.12.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.11.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.10.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.9.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.8.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.7.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.6.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.5.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.4.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.3.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.2.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.1.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/2.0.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/1.4.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/1.3.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/1.2.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/1.1.0/Google.Cloud.CloudBuild.V1.PullRequestFilter)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/1.0.0/Google.Cloud.CloudBuild.V1.PullRequestFilter) \n\n public sealed class PullRequestFilter : IMessage\u003cPullRequestFilter\u003e, IEquatable\u003cPullRequestFilter\u003e, IDeepCloneable\u003cPullRequestFilter\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Build v1 API class PullRequestFilter.\n\nPullRequestFilter contains filter properties for matching GitHub Pull\nRequests. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PullRequestFilter \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PullRequestFilter](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/latest/Google.Cloud.CloudBuild.V1.PullRequestFilter), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PullRequestFilter](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/latest/Google.Cloud.CloudBuild.V1.PullRequestFilter), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PullRequestFilter](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/latest/Google.Cloud.CloudBuild.V1.PullRequestFilter), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.CloudBuild.V1](/dotnet/docs/reference/Google.Cloud.CloudBuild.V1/latest/Google.Cloud.CloudBuild.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.CloudBuild.V1.dll\n\nConstructors\n------------\n\n### PullRequestFilter()\n\n public PullRequestFilter()\n\n### PullRequestFilter(PullRequestFilter)\n\n public PullRequestFilter(PullRequestFilter other)\n\nProperties\n----------\n\n### Branch\n\n public string Branch { get; set; }\n\nRegex of branches to match.\n\nThe syntax of the regular expressions accepted is the syntax accepted by\nRE2 and described at \u003chttps://github.com/google/re2/wiki/Syntax\u003e\n\n### CommentControl\n\n public PullRequestFilter.Types.CommentControl CommentControl { get; set; }\n\nIf CommentControl is enabled, depending on the setting, builds may not\nfire until a repository writer comments `/gcbrun` on a pull\nrequest or `/gcbrun` is in the pull request description.\nOnly PR comments that contain `/gcbrun` will trigger builds.\n\nIf CommentControl is set to disabled, comments with `/gcbrun` from a user\nwith repository write permission or above will\nstill trigger builds to run.\n\n### GitRefCase\n\n public PullRequestFilter.GitRefOneofCase GitRefCase { get; }\n\n### HasBranch\n\n public bool HasBranch { get; }\n\nGets whether the \"branch\" field is set\n\n### InvertRegex\n\n public bool InvertRegex { get; set; }\n\nIf true, branches that do NOT match the git_ref will trigger a build."]]