find_deprecated: Read the archived
status of the upstream repository
This commit is contained in:
parent
1a685249cf
commit
179b5f319a
@ -40,6 +40,10 @@ class GithubAPI:
|
|||||||
"""Get a list of releases for project."""
|
"""Get a list of releases for project."""
|
||||||
return self.internal_api(f"repos/{self.upstream_repo}/releases")
|
return self.internal_api(f"repos/{self.upstream_repo}/releases")
|
||||||
|
|
||||||
|
def archived(self) -> bool:
|
||||||
|
"""Return the archival status for the repository"""
|
||||||
|
return self.internal_api(f"repos/{self.upstream_repo}")["archived"]
|
||||||
|
|
||||||
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
||||||
"""Get a URL for a ref."""
|
"""Get a URL for a ref."""
|
||||||
if ref_type == RefType.tags:
|
if ref_type == RefType.tags:
|
||||||
@ -128,6 +132,10 @@ class GitlabAPI:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
def archived(self) -> bool:
|
||||||
|
"""Return the archival status for the repository"""
|
||||||
|
return self.internal_api(f"projects/{self.project_id}")["archived"]
|
||||||
|
|
||||||
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
||||||
name = self.project_path.split("/")[-1]
|
name = self.project_path.split("/")[-1]
|
||||||
clean_ref = ref.replace("/", "-")
|
clean_ref = ref.replace("/", "-")
|
||||||
@ -166,6 +174,10 @@ class GiteaForgejoAPI:
|
|||||||
"""Get a list of releases for project."""
|
"""Get a list of releases for project."""
|
||||||
return self.internal_api(f"repos/{self.project_path}/releases")
|
return self.internal_api(f"repos/{self.project_path}/releases")
|
||||||
|
|
||||||
|
def archived(self) -> bool:
|
||||||
|
"""Return the archival status for the repository"""
|
||||||
|
return self.internal_api(f"repos/{self.project_path}")["archived"]
|
||||||
|
|
||||||
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
||||||
"""Get a URL for a ref."""
|
"""Get a URL for a ref."""
|
||||||
return f"{self.forge_root}/{self.project_path}/archive/{ref}.tar.gz"
|
return f"{self.forge_root}/{self.project_path}/archive/{ref}.tar.gz"
|
||||||
|
@ -39,7 +39,6 @@ def get_github() -> tuple[Optional[tuple[str, str]], Optional[github.Github], Op
|
|||||||
return None, None, None
|
return None, None, None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def upstream_last_update_ago(app: str) -> tuple[str, int | None]:
|
def upstream_last_update_ago(app: str) -> tuple[str, int | None]:
|
||||||
manifest_toml = app_cache_folder(app) / "manifest.toml"
|
manifest_toml = app_cache_folder(app) / "manifest.toml"
|
||||||
manifest_json = app_cache_folder(app) / "manifest.json"
|
manifest_json = app_cache_folder(app) / "manifest.json"
|
||||||
@ -75,6 +74,10 @@ def upstream_last_update_ago(app: str) -> tuple[str, int | None]:
|
|||||||
api = GiteaForgejoAPI(upstream)
|
api = GiteaForgejoAPI(upstream)
|
||||||
|
|
||||||
if api:
|
if api:
|
||||||
|
if api.archived():
|
||||||
|
# A stupid value that we know to be higher than the trigger value
|
||||||
|
return app, 1000
|
||||||
|
|
||||||
last_commit = api.commits()[0]
|
last_commit = api.commits()[0]
|
||||||
date = last_commit["commit"]["author"]["date"]
|
date = last_commit["commit"]["author"]["date"]
|
||||||
date = datetime.datetime.fromisoformat(date)
|
date = datetime.datetime.fromisoformat(date)
|
||||||
|
Loading…
Reference in New Issue
Block a user