Only send commit requests when needed
This commit is contained in:
parent
d3e2547ee6
commit
45a03db02f
1 changed files with 14 additions and 8 deletions
20
archiver.py
20
archiver.py
|
@ -3,18 +3,24 @@ import os
|
||||||
|
|
||||||
ARCHIVE_ORG = "archive"
|
ARCHIVE_ORG = "archive"
|
||||||
|
|
||||||
|
def set_if_needed(item, attr, value):
|
||||||
|
if getattr(item, attr) != value:
|
||||||
|
setattr(item, attr, value)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
gitea = Gitea(os.environ["GITEA_URL"], os.environ["GITEA_TOKEN"])
|
gitea = Gitea(os.environ["GITEA_URL"], os.environ["GITEA_TOKEN"])
|
||||||
|
|
||||||
org = Organization.request(gitea, ARCHIVE_ORG)
|
org = Organization.request(gitea, ARCHIVE_ORG)
|
||||||
|
print("Fetching repositories...")
|
||||||
for repo in org.get_repositories():
|
for repo in org.get_repositories():
|
||||||
print(repo.get_full_name())
|
set_if_needed(repo, "archived", True)
|
||||||
repo.archived = True
|
set_if_needed(repo, "has_projects", False)
|
||||||
repo.has_projects = False
|
set_if_needed(repo, "has_issues", False)
|
||||||
repo.has_issues = False
|
set_if_needed(repo, "has_pull_requests", False)
|
||||||
repo.has_pull_requests = False
|
set_if_needed(repo, "has_wiki", False)
|
||||||
repo.has_wiki = False
|
|
||||||
|
if repo.get_dirty_fields():
|
||||||
|
print("Updating", repo.get_full_name())
|
||||||
repo.commit()
|
repo.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue