Skip to content

Commit f7efc4a

Browse files
authored
GitHubBranches: Add Get/New/Remove GitHub Repository Branch Pattern Protection Rule (#313)
Adds the following functions to the `GitHubBranches` module: * `Invoke-GHGraphQl` * `Get-GitHubRepositoryBranchPatternProtectionRule` * `New-GitHubRepositoryBranchPatternProtectionRule` * `Remove-GitHubRepositoryBranchPatternProtectionRule` `Invoke-GHGraphQl` is based on `Invoke-GHRestMethod` but modified with the following features: * Use of the GitHub GraphQL API Endpoint. * PowerShell 5 and 6+ `Invoke-WebRequest` error handling support. * Use of `ThrowTerminatingError` instead of `Throw` for enhanced exceptions and hiding the internal details of the function. Reference: [Everything you wanted to know about exceptions](https://docs.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-exceptions) * GraphQl specific error handling. * Extensive debug logging. Fixes #312 References * [createbranchprotectionrule](https://docs.github.com/en/graphql/reference/mutations#createbranchprotectionrule) * [deletebranchprotectionrule](https://docs.github.com/en/graphql/reference/mutations#deletebranchprotectionrule) * [branchprotectionrule](https://docs.github.com/en/graphql/reference/objects#branchprotectionrule)
1 parent 0ebf9e8 commit f7efc4a

9 files changed

+2422
-85
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Configuration>
3+
<ViewDefinitions>
4+
<!--=============== GitHub.BranchPatternProtectionRule Type View ===============-->
5+
<View>
6+
<Name>GitHub.BranchPatternProtectionRule</Name>
7+
<ViewSelectedBy>
8+
<TypeName>GitHub.BranchPatternProtectionRule</TypeName>
9+
</ViewSelectedBy>
10+
<ListControl>
11+
<ListEntries>
12+
<ListEntry>
13+
<ListItems>
14+
<ListItem>
15+
<PropertyName>RepositoryUrl</PropertyName>
16+
</ListItem>
17+
<ListItem>
18+
<PropertyName>pattern</PropertyName>
19+
</ListItem>
20+
<ListItem>
21+
<PropertyName>requiredApprovingReviewCount</PropertyName>
22+
</ListItem>
23+
<ListItem>
24+
<PropertyName>dismissesStaleReviews</PropertyName>
25+
</ListItem>
26+
<ListItem>
27+
<PropertyName>requiresCodeOwnerReviews</PropertyName>
28+
</ListItem>
29+
<ListItem>
30+
<PropertyName>DismissalTeams</PropertyName>
31+
</ListItem>
32+
<ListItem>
33+
<PropertyName>DismissalUsers</PropertyName>
34+
</ListItem>
35+
<ListItem>
36+
<PropertyName>requiresStatusChecks</PropertyName>
37+
</ListItem>
38+
<ListItem>
39+
<PropertyName>requiresStrictStatusChecks</PropertyName>
40+
</ListItem>
41+
<ListItem>
42+
<PropertyName>requiredStatusCheckContexts</PropertyName>
43+
</ListItem>
44+
<ListItem>
45+
<PropertyName>requiresCommitSignatures</PropertyName>
46+
</ListItem>
47+
<ListItem>
48+
<PropertyName>requiresLinearHistory</PropertyName>
49+
</ListItem>
50+
<ListItem>
51+
<PropertyName>isAdminEnforced</PropertyName>
52+
</ListItem>
53+
<ListItem>
54+
<PropertyName>RestrictPushApps</PropertyName>
55+
</ListItem>
56+
<ListItem>
57+
<PropertyName>RestrictPushTeams</PropertyName>
58+
</ListItem>
59+
<ListItem>
60+
<PropertyName>RestrictPushUsers</PropertyName>
61+
</ListItem>
62+
<ListItem>
63+
<PropertyName>allowsForcePushes</PropertyName>
64+
</ListItem>
65+
<ListItem>
66+
<PropertyName>allowsDeletions</PropertyName>
67+
</ListItem>
68+
</ListItems>
69+
</ListEntry>
70+
</ListEntries>
71+
</ListControl>
72+
</View>
73+
</ViewDefinitions>
74+
</Configuration>

0 commit comments

Comments
 (0)