@@ -144,55 +144,11 @@ def _get_gh_remote_url(github_username: str, repo_name: str) -> Literal["https",
144144 # Default to https if not set
145145 return "https"
146146
147- def _tag_exists (tag : str ) -> bool :
148- """Check if a git tag exists."""
149- try :
150- _git (f"rev-parse { tag } " , capture_output = True )
151- return True
152- except subprocess .CalledProcessError :
153- return False
154-
155-
156- def _branch_exists (branch : str ) -> bool :
157- """Check if a git branch exists."""
158- try :
159- _git (f"rev-parse --verify { branch } " , capture_output = True )
160- return True
161- except subprocess .CalledProcessError :
162- return False
163-
164147
165148def _github_repo_exists (username : str , repo_name : str ) -> bool :
166149 """Check if a GitHub repository exists."""
167150 try :
168151 _gh (f"repo view { username } /{ repo_name } " , capture_output = True )
169152 return True
170153 except subprocess .CalledProcessError :
171- return False
172-
173-
174- def _is_repo_public (username : str , repo_name : str ) -> bool :
175- """Check if a GitHub repository is public."""
176- result = _gh (
177- f"api repos/{ username } /{ repo_name } -q .private" , capture_output = True , text = True
178- )
179- return result .stdout .strip () == "false"
180-
181-
182- def _set_branch_protection (username : str , repo_name : str , branch : str ) -> None :
183- """Set branch protection rules. Only works with enterprise(?)."""
184- protection_data = {
185- "required_status_checks" : {"strict" : True , "contexts" : []},
186- "enforce_admins" : True ,
187- "required_pull_request_reviews" : {"required_approving_review_count" : 1 },
188- "restrictions" : None ,
189- }
190-
191- _gh (
192- f"api repos/{ username } /{ repo_name } /branches/{ branch } /protection "
193- "-X PUT -H 'Accept: application/vnd.github.v3+json' "
194- f"-f required_status_checks='{ protection_data ['required_status_checks' ]} ' "
195- f"-f enforce_admins={ protection_data ['enforce_admins' ]} "
196- f"-f required_pull_request_reviews='{ protection_data ['required_pull_request_reviews' ]} ' "
197- f"-f restrictions={ protection_data ['restrictions' ]} "
198- )
154+ return False
0 commit comments