summaryrefslogtreecommitdiff
path: root/lib/Net/GitHub/V3/Repos.pm
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2022-10-08 17:26:11 +0200
committergregor herrmann <gregoa@debian.org>2022-10-08 17:26:11 +0200
commitb1a660b3ea7b75616796ec4bbd84e98c11f6b3b5 (patch)
treeebbc763011dfd3bfd5a8f46499b5dec5c6f381a1 /lib/Net/GitHub/V3/Repos.pm
parent0b195e3f56c9918f65f32d749522f40a2360947d (diff)
parentce57ef6ff0bdeaac52e68779fc3765ef65ce1da9 (diff)
Update upstream source from tag 'upstream/1.05'
Update to upstream version '1.05' with Debian dir 3f357d23ebb644a9858007c618cead6ff11ea7c5
Diffstat (limited to 'lib/Net/GitHub/V3/Repos.pm')
-rw-r--r--lib/Net/GitHub/V3/Repos.pm43
1 files changed, 42 insertions, 1 deletions
diff --git a/lib/Net/GitHub/V3/Repos.pm b/lib/Net/GitHub/V3/Repos.pm
index fb39359..df4136c 100644
--- a/lib/Net/GitHub/V3/Repos.pm
+++ b/lib/Net/GitHub/V3/Repos.pm
@@ -2,7 +2,7 @@ package Net::GitHub::V3::Repos;
use Moo;
-our $VERSION = '1.03';
+our $VERSION = '1.05';
our $AUTHORITY = 'cpan:FAYLAND';
use Carp;
@@ -336,6 +336,10 @@ my %__methods = (
participation => { url => "/repos/%s/%s/stats/participation", method => 'GET'},
punch_card => { url => "/repos/%s/%s/stats/punch_card", method => 'GET'},
+ # https://docs.github.com/en/rest/branches/branch-protection
+ branch_protection => { url => "/repos/%s/%s/branches/%s/protection", method => 'GET'},
+ delete_branch_protection => { url => "/repos/%s/%s/branches/%s/protection", method => 'DELETE', check_status => 204 },
+ update_branch_protection => { url => "/repos/%s/%s/branches/%s/protection", method => 'PUT', args => 1 },
);
__build_methods(__PACKAGE__, %__methods);
@@ -996,6 +1000,43 @@ L<http://developer.github.com/v3/repos/statistics/>
=back
+=head3 Branch Protection API
+
+L<https://docs.github.com/en/rest/branches/branch-protection>
+
+=over 4
+
+=item branch_protection
+
+ my $protection = $repos->branch_protection('fayland', 'perl-net-github', 'master');
+
+=item delete_branch_protection
+
+ $repos->delete_branch_protection('fayland', 'perl-net-github', 'master');
+
+=item update_branch_protection
+
+ $repos->update_branch_protection('fayland', 'perl-net-github', 'master', {
+ allow_deletions => \0,
+ allow_force_pushes => \0,
+ block_creations => \1,
+ enforce_admins => \1,
+ required_conversation_resolution => \1,
+ required_linear_history => \0,
+ required_pull_request_reviews => {
+ dismiss_stale_reviews => \1,
+ require_code_owner_reviews => \1,
+ required_approving_review_count => 2,
+ },
+ required_status_checks => {
+ strict => \1,
+ contexts => []
+ },
+ restrictions => undef,
+ });
+
+=back
+
=head1 AUTHOR & COPYRIGHT & LICENSE
Refer L<Net::GitHub>