Skip to content

Support Codeberg and GitLab for Code Repositories #96

Description

@egrace479

I did a review of the repository attributes we used for Codeberg and GitLab:

GitHub (Attribute) Codeberg GitLab
name
full_name name_with_namespace
fork ❌ (No clear indicator)
forks_count
created_at
updated_at
topics
archived
description
html_url web_url
stargazers_count stars_count star_count

Codeberg repo attributes and GitLab project attributes.

We can then do stars: repo.stargazers_count || repo.stars_count || repo.star_count and similar in other locations where the attributes differ. It looks like we could potentially check forked_from_project for GitLab (I think it would be existence of this key indicating it's a fork).

Key distinctions in API calls:

Request GitHub Codeberg GitLab
List all repos in Org https://api.github.com/orgs/${ORGANIZATION_NAME}/repos?type=public&per_page=100 https://codeberg.org/api/v1/orgs/${ORGANIZATION_NAME}/repos?limit=50 https://gitlab.com/api/v4/groups/${ORGANIZATION_NAME}/projects?visibility=public&per_page=100
get repo info https://api.github.com/repos/${ownerRepo} https://codeberg.org/api/v1/repos/${ownerRepo} https://gitlab.com/api/v4/projects/${ownerRepo}
Org orgs/ orgs/ groups/
visibility type=public default is public without authentication, may support type=public visibility=public
pagination per_page=100 limit=50 per_page, limit needs to be checked
Request (URL end) /repos?type=public&per_page=100 /repos?limit=50 /projects?visibility=public&per_page=100
Repo repos/ repos/ projects/1

Discussed with @thompsonmj, and it seems simplest for an end-user to have a single PLATFORM key in the config file, then define the URLs based on the designated platform ('github', 'codeberg', or 'gitlab'). We'd set 'github' as the default. The URL definitions are needed in main.js and the two scripts (export-tags.js and fetch-releases.js, which would need some other platform-specific modifications). Then index.html needs the platform for the Ribbon: title and SVG vector path definition. This would also avoid concerns about trailing slashes because we will be constructing URLs.

Footnotes

  1. For GitLab, it emphasizes URL-encoded NAMESPACE/PROJECT_PATH or the project id can be used (this is relevant for the ADDITIONAL_REPOS config; regular repo info fetch uses full_name).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststructureRefactoring or architecture, general code organization

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions