Skip to content

Add GitLab as a code repository platform option - #134

Open
egrace479 wants to merge 19 commits into
devfrom
feat/gitlab
Open

Add GitLab as a code repository platform option#134
egrace479 wants to merge 19 commits into
devfrom
feat/gitlab

Conversation

@egrace479

@egrace479 egrace479 commented Aug 11, 2026

Copy link
Copy Markdown
Member

This PR adds GitLab as an option for the coding platform and updates the documentation accordingly. I also updated the scripts for use with Codeberg and GitLab (assuming environment tokens named for the platforms), though I don't have tokens to test the functionality, the un-authenticated builds did include releases. I included the platform-specific dummy configs I used for testing each platform in the personalization docs.

I used https://gitlab.com/gitlab-com for testing.
Screenshot of a Fake GitLab.com catalog, shows repos from the organization with a highlighted ribbon (tags, stars, and forks enumerated) linking to one of the GitLab repos used as the dummy catalog

Closes #96.

@egrace479
egrace479 requested a lite review from Copilot August 11, 2026 00:13
@egrace479 egrace479 added documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update javascript code labels Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitLab as a supported code repository platform option in this catalog template by expanding platform validation, platform-specific UI/ribbon metadata (including a GitLab SVG), and updating documentation/config guidance to reference GitHub/GitLab/Codeberg support.

Changes:

  • Extend supported platform lists (tests + config validation) to include gitlab.
  • Add GitLab platform mappings for ribbon display and platform value definitions (API URLs + repo key mappings).
  • Update docs/config to document GitLab usage and include sample non-GitHub configs; adjust catalog stats fetching to recognize GitLab star fields and URL-encode owner/repo for GitLab API calls.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/api/fetchCodeRepos.test.js Adds gitlab to the platform matrix test coverage.
src/validateConfig.js Allows gitlab as a valid PLATFORM.
src/utils/defineRibbonVals.js Adds GitLab ribbon display values and imports GitLab SVG.
src/utils/definePlatformVals.js Adds GitLab key mappings and GitLab API URL definitions.
src/assets/gitlab-logo-700-rgb.svg Adds GitLab SVG asset for the ribbon icon.
src/api/fetchStats.js Adds GitLab-aware owner/repo encoding and supports GitLab star counts.
src/api/fetchCodeRepos.js Updates JSDoc to reflect gitlab support.
scripts/fetch-releases.js Updates comments for non-GitHub platform setup (plus a small typo fix suggested).
scripts/export-tags.js Updates comments for non-GitHub platform setup (plus a small typo fix suggested).
README.md Updates overview to mention GitLab/Codeberg support.
public/config.yaml Documents gitlab as a supported platform and notes GitLab ADDITIONAL_REPOS encoding.
docs/personalization.md Adds non-GitHub setup section and sample configs including GitLab; updates PLATFORM docs.
AGENTS.md Updates agent-facing documentation to reflect multi-platform support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/api/fetchStats.js Outdated
Comment thread src/utils/definePlatformVals.js Outdated
Comment thread src/utils/definePlatformVals.js
Comment thread scripts/fetch-releases.js Outdated
Comment thread scripts/export-tags.js Outdated
Comment thread docs/personalization.md Outdated
Comment thread docs/personalization.md Outdated
Comment thread src/validateConfig.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

src/utils/definePlatformVals.js:26

  • path_with_namespace is the right GitLab identity key, but org repo IDs are later interpolated unchanged into ${REPO_API_URL}${id}/... in scripts/fetch-releases.js:61,68. GitLab requires group/project to be one URL-encoded project-ID segment, so release requests for every discovered org project use /projects/group/project/... and return 404. Keep this value unencoded as the catalog/release-map key, but encode it when constructing GitLab project API URLs.
        fullNameKey: 'path_with_namespace',

src/utils/definePlatformVals.js:28

  • This key is also used for release records in scripts/fetch-releases.js:73, but GitLab release responses do not provide web_url; their browser-facing release URL is under _links.self. Consequently releases.json stores an undefined URL and rendered new-release badges link to null. Use separate project and release URL accessors for GitLab.
        urlKey: 'web_url',

src/validateConfig.js:44

  • An unrecognized platform adds a descriptive error such as PLATFORM must be one of..., so errors.includes('PLATFORM') is false. Organization validation then falls through to the GitLab/Codeberg regex with an empty validPlatform, potentially producing the malformed message invalid for API calls. Guard on validPlatform directly.
    } else if (!errors.includes('PLATFORM')) {

Comment thread scripts/fetch-releases.js Outdated
Co-authored-by: egrace479 <38985481+egrace479@users.noreply.github.com>
@egrace479
egrace479 requested a balanced review from Copilot August 12, 2026 16:11
@egrace479
egrace479 requested a review from beanbean9339 August 12, 2026 16:48
@egrace479 egrace479 linked an issue Aug 12, 2026 that may be closed by this pull request
@egrace479

Copy link
Copy Markdown
Member Author

Releases for GitLab and Codeberg do also populate after build with the test configs.

@egrace479
egrace479 requested a balanced review from Copilot and removed request for Copilot August 12, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/utils/definePlatformVals.js:27

  • GitLab’s profile README project is named .gitlab-profile. Using gitlab-profile here leaves the actual profile project in catalog results and incorrectly excludes an unrelated project with the unprefixed name. Please use the canonical dotted name.
        profileRepo: 'gitlab-profile',

src/utils/definePlatformVals.js:32

  • urlKey is also used by fetch-releases.js to read the release link, but GitLab release responses do not have a top-level web_url; the browser link is in _links.self. As a result, recent GitLab releases produce url: undefined, and the rendered release badge links to undefined. Separate the project URL mapping from the release URL extraction (for example, add a GitLab-specific release URL accessor for _links.self and use it in fetch-releases.js).
        urlKey: 'web_url',
        releasePublishedAtKey: 'released_at',

scripts/export-tags.js:50

  • This removes the existing GH_TOKEN fallback, so local/tag-export runs that use the standard GitHub CLI environment variable silently become unauthenticated and can hit the much lower API rate limit. Preserve the fallback while adding platform-specific tokens.
        token: process.env.GITHUB_TOKEN,

docs/personalization.md:94

  • This setup guidance is now stale: both scripts added in this PR already select platform-specific tokens and authorization schemes, so users should not modify their header definitions. It also implies workflow token changes are needed only when hosting outside GitHub, although a GitHub-hosted catalog using GitLab/Codeberg must expose the corresponding token if authenticated requests are desired. Document the environment variables/workflow wiring instead of directing template users to edit source code.
The default code repository platform for this catalog is GitHub. If you wish to use another supported platform (Codeberg or GitLab), please note that the [tag export](../scripts/export-tags.js) and [fetch release](../scripts/fetch-releases.js) scripts require header definition modifications to function properly. Notes are provided at the relevant lines (under "Update this section as needed for non-GitHub code platforms"). Workflows would also require token and other platform-specific updates if running from a non-GitHub repository. Otherwise, this app is set up to be able to run from Codeberg or GitLab to fetch and display repositories from the respective platform.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/utils/definePlatformVals.js:70

  • GitLab's group-projects API defaults to excluding subgroup projects and including projects merely shared into the group. For a root organization this can therefore omit owned repositories and add repositories from other namespaces. Set include_subgroups=true and with_shared=false so the catalog represents the group's public project tree.
            org: `https://gitlab.com/api/v4/groups/${organizationName}/projects?visibility=public&per_page=100`,

scripts/platformScriptHelpers.js:21

  • GitLab's release _links.self points to the REST API resource rather than the browser release page, while the fallback is a relative URL containing an encoded project separator. As a result, release badges open JSON or a broken local URL. Construct the GitLab web URL explicitly and encode only the tag.
        getReleaseUrl: (data, encodedRepoId) => data._links?.self || `${encodedRepoId}/-/releases/${data.tag_name}`, // GitLab response can be inconsistent, so we provide a fallback URL if _links.self is not present

scripts/fetch-releases.js:64

  • Promise.all dispatches one release request per repository without a concurrency limit. Large organizations can exceed platform secondary/concurrent request limits, after which non-OK responses are silently recorded as null, so builds lose release badges. Keep the previous sequential behavior or use a small bounded worker pool.
const releaseEntries = await Promise.all(
    repoIds.map(async (id) => {

tests/validateConfig.test.js:71

  • These invalid values contain spaces, so they are rejected by every platform regex and do not verify the newly introduced underscore support. Add positive abc_center cases for GitLab and Codeberg; otherwise reverting both to the GitHub regex would still leave these tests green.
        const config = { ...VALID_CONFIG, PLATFORM: 'gitlab', ORGANIZATION_NAME: 'abc center' };
        expect(validateConfig(config)).toContain('ORGANIZATION_NAME (abc center) is invalid for gitlab API calls, only letters, numbers, hyphens, and underscores are allowed');

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.

Comment thread src/utils/definePlatformVals.js Outdated
consistent with the stated goal of the catalog and the way in which GitLab presents a group's projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Codeberg and GitLab for Code Repositories

3 participants