Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Protection to Branch struct #3095

Merged
merged 1 commit into from Mar 11, 2024

Conversation

jscaltreto
Copy link
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.
Copy link

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
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.

@gmlewis gmlewis merged commit 2c1b36c into google:master Mar 11, 2024
6 of 7 checks passed
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.

None yet

2 participants