Module: StillActive::ForgejoClient

Extended by:
ForgejoClient
Included in:
ForgejoClient
Defined in:
lib/still_active/forgejo_client.rb

Overview

Repo signals (archived?, last commit date) for Forgejo/Gitea-hosted gems. Codeberg.org is the only host wired into the workflow today, but every Forgejo/Gitea instance speaks the same ‘/api/v1` surface, so the host is a parameter for later self-hosted support. Mirrors GitlabClient: HttpHelper against a documented JSON API, anonymous by default with an optional token.

Constant Summary collapse

DEFAULT_HOST =
"codeberg.org"

Instance Method Summary collapse

Instance Method Details

#repo_signals(owner:, name:, host: DEFAULT_HOST) ⇒ Object

archived + last-activity date from a single repository call. The repo object’s updated_at matches the latest commit date to the day in practice, so folding the two signals into one call halves the per-gem requests. Returns {} when the repo can’t be read.



21
22
23
24
25
26
27
28
# File 'lib/still_active/forgejo_client.rb', line 21

def repo_signals(owner:, name:, host: DEFAULT_HOST)
  return {} if owner.nil? || name.nil?

  body = HttpHelper.get_json(base_uri(host), "/api/v1/repos/#{owner}/#{name}", headers: auth_headers)
  return {} if body.nil?

  { archived: body["archived"] == true, last_commit_date: parse_time(body["updated_at"], owner, name) }
end