Skip to content

Add Protection to Branch struct#3095

Merged
gmlewis merged 1 commit intogoogle:masterfrom
jscaltreto:branch-protection-in-branch
Mar 11, 2024
Merged

Add Protection to Branch struct#3095
gmlewis merged 1 commit intogoogle:masterfrom
jscaltreto:branch-protection-in-branch

Conversation

@jscaltreto
Copy link
Copy Markdown
Contributor

Details regarding branch protection are provided APIs which return the "Branch With Protection" schema, such as
'Get a branch'. This allows for getting branch protection information without needing to explicitly call the "Get branch protection" API. As the latter requires administration:read permissions while the former only requires contents:read, this enables users view branch protection information without requiring elevated permissions.

The 'List branches' API returns the Short Branch schema, which does not include protection, but since protected will still be true, a user could subsequently call 'Get a branch' to get further details.

Details regarding branch protection are provided APIs which return the
"Branch With Protection" schema, such as
'[Get a branch](https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#get-a-branch)'.
This allows for getting branch protection information without needing to
explicitly call the "Get branch protection" API. As the latter requires
`administration:read` permissions while the former only requires `contents:read`,
this enables users view branch protection information without requiring
elevated permissions.

The '[List branches](https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#list-branches)'
API returns the `Short Branch` schema, which does not include `protection`,
but since `protected` will still be `true`, a user could subsequently call
'Get a branch' to get further details.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.87%. Comparing base (2b8c7fa) to head (e374ac8).
Report is 19 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3095      +/-   ##
==========================================
- Coverage   97.72%   92.87%   -4.86%     
==========================================
  Files         153      170      +17     
  Lines       13390    11403    -1987     
==========================================
- Hits        13085    10590    -2495     
- Misses        215      723     +508     
  Partials       90       90              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jscaltreto !
LGTM.
Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants