From 3cddb151fba6552754c77d9a464769424982ca17 Mon Sep 17 00:00:00 2001 From: bbhtt Date: Tue, 9 Jul 2024 14:03:51 +0530 Subject: [PATCH] Add a cutoff period before archiving --- .github/scripts/archive_eol.py | 9 +++++++-- .github/workflows/archive.yml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/scripts/archive_eol.py b/.github/scripts/archive_eol.py index 6dc68e9..821b21a 100644 --- a/.github/scripts/archive_eol.py +++ b/.github/scripts/archive_eol.py @@ -1,3 +1,4 @@ +import datetime import os import subprocess import time @@ -90,8 +91,12 @@ def main() -> None: refname = eols[count] try: repo = g.get_repo(f"flathub/{refname}") - if not repo.archived: - print("Archiving {}".format(repo.html_url)) + 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() + ) + ) repo.edit(archived=True) except UnknownObjectException: pass diff --git a/.github/workflows/archive.yml b/.github/workflows/archive.yml index 8455738..89f6eb9 100644 --- a/.github/workflows/archive.yml +++ b/.github/workflows/archive.yml @@ -2,7 +2,7 @@ name: Archive EOL repositories on: schedule: - - cron: '0 14 * * 1' + - cron: '0 0 1 * *' workflow_dispatch: {} jobs: