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

[Bug Fix] Fix protected branches current configuration access level fetching #474

Merged

Conversation

BenKuhar
Copy link

The get_current_permissions method in branch_protector.py does not properly account for returned access_levels when they are set to 0.

This PR just adds a verification that the access_level value is present, otherwise the if check becomes if 0: when the 0 access level is set, which equates to False, resulting in unnecessary reapplications of branch protection settings.

@BenKuhar BenKuhar temporarily deployed to Integrate Pull Request January 11, 2023 21:03 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Merging #474 (267ee06) into main (dca1cd0) will increase coverage by 4.13%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #474      +/-   ##
==========================================
+ Coverage   76.73%   80.87%   +4.13%     
==========================================
  Files          70       70              
  Lines        2635     2635              
==========================================
+ Hits         2022     2131     +109     
+ Misses        613      504     -109     
Impacted Files Coverage Δ
gitlabform/processors/util/branch_protector.py 60.68% <100.00%> (-1.71%) ⬇️
gitlabform/lists/filter.py 97.72% <0.00%> (+2.27%) ⬆️
gitlabform/gitlab/__init__.py 100.00% <0.00%> (+2.38%) ⬆️
gitlabform/processors/abstract_processor.py 84.61% <0.00%> (+16.92%) ⬆️
gitlabform/configuration/core.py 82.60% <0.00%> (+19.25%) ⬆️
gitlabform/configuration/transform.py 88.46% <0.00%> (+23.71%) ⬆️
gitlabform/configuration/groups.py 100.00% <0.00%> (+39.21%) ⬆️
gitlabform/processors/util/difference_logger.py 81.81% <0.00%> (+45.45%) ⬆️

@gdubicki
Copy link
Member

Hey @BenKuhar! Thank you for your contribution! But could you please also add a test using your new code that will show that the bug is fixed?

@BenKuhar BenKuhar had a problem deploying to Integrate Pull Request January 12, 2023 22:02 — with GitHub Actions Failure
@BenKuhar
Copy link
Author

Hey @BenKuhar! Thank you for your contribution! But could you please also add a test using your new code that will show that the bug is fixed?

Added, let me know if any other changes are needed.

@gdubicki gdubicki merged commit 7ee8967 into gitlabform:main Jan 13, 2023
@gdubicki
Copy link
Member

Released in v3.3.4.

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

3 participants