archive_eol: Use last commit time on default branch instead of pushed_at

pushed_at counts all branches so if x-checker is making new PRs it won't
be countted even if the repo is inactive
This commit is contained in:
bbhtt
2024-09-20 08:52:18 +05:30
parent b5e9fe9afc
commit fe7035367c
+17 -8
View File
@@ -113,15 +113,24 @@ def main() -> None:
refname = eols[count]
try:
repo = g.get_repo(f"flathub/{refname}")
if not repo.archived and repo.pushed_at < earliest:
print(
"Archiving: {} Repo is in EOL list. Last push: {}, earlier than: {}".format(
repo.html_url, repo.pushed_at.isoformat(), earliest.isoformat()
)
if not repo.archived:
default_branch = repo.default_branch
branch = repo.get_branch(default_branch)
last_commit = repo.get_commit(branch.commit.sha)
last_commit_time = last_commit.commit.committer.date.astimezone(
datetime.timezone.utc
)
desc = "This repo is archived as the app is EOL."
repo.edit(description=desc)
repo.edit(archived=True)
if last_commit_time < earliest:
print(
"Archiving: {} Repo is in EOL list. Last push: {}, earlier than: {}".format(
repo.html_url,
last_commit_time.isoformat(),
earliest.isoformat(),
)
)
desc = "This repo is archived as the app is EOL."
repo.edit(description=desc)
repo.edit(archived=True)
except UnknownObjectException:
pass
except RateLimitExceededException: