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

Automatic branch deletion: create a Change when the current value is different from the desired value #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ghconf/plumbing/repositories/common_procs.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,15 @@ def delete_branch_on_merge(org: Organization, repo: Repository,
Turns on a feature that enforces automatic branch deletion when a PR is merged
"""
def _set_delete_branch_on_merge(change: Change[str]) -> Change[str]:
print_debug("[%s] Enforcing branch deletion on PR merge" % highlight(repo.name))
print_debug("[%s] Setting branch deletion on PR merge" % highlight(repo.name))
try:
repo.edit(delete_branch_on_merge=value)
except GithubException:
return change.failure()

return change.success()

if not repo.delete_branch_on_merge:
if repo.delete_branch_on_merge != value:
change = Change(
meta=ChangeMetadata(
executor=_set_delete_branch_on_merge,
Expand Down