Skip to content

Commit

Permalink
delete tag
Browse files Browse the repository at this point in the history
  • Loading branch information
luiztauffer committed Nov 12, 2023
1 parent e600b30 commit 52ac0d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/domino/cli/utils/pieces_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def delete_release(tag_name: str):
if tag:
# Delete release by tag
client.delete_release_by_tag(repo_name=repository, tag_name=tag_name)
client.delete_tag(repo_name=repository, tag_name=tag_name)
console.print(f"Attempting to delete release {tag_name}...", style="bold")
timeout = 30 # 30 seconds timeout
start_time = time.time()
Expand Down
13 changes: 13 additions & 0 deletions src/domino/client/github_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,16 @@ def delete_release_by_tag(self, repo_name: str, tag_name: str):
release_to_delete.delete_release()
except Exception as e:
raise Exception(f"An error occurred: {e}")

def delete_tag(self, repo_name: str, tag_name: str):
"""
Delete a tag from a GitHub repository.
"""
repo = super().get_repo(repo_name)
try:
# Delete tag by reference
ref = 'tags/' + tag_name
repo.get_git_ref(ref).delete()
print(f"Tag '{tag_name}' deleted successfully.")
except Exception as e:
raise Exception(f"Error deleting tag: {e}")

0 comments on commit 52ac0d3

Please sign in to comment.