Skip to content

fix(init): fix handling of gitlab repos#7945

Open
sarahetter wants to merge 14 commits intomainfrom
sarahetter/gitlab
Open

fix(init): fix handling of gitlab repos#7945
sarahetter wants to merge 14 commits intomainfrom
sarahetter/gitlab

Conversation

@sarahetter
Copy link
Copy Markdown
Contributor

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes #3771

Also not described in the issue was that we weren't displaying the correct webhook for gitlab users to add manually since we were passing through manual instead of gitlab - now it actually shows Configure the following webhook for your repository: https://api.netlify.com/hooks/gitlab as it should (and was in the code, just wasn't being exercised).


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)
image

@sarahetter sarahetter requested a review from a team as a code owner February 13, 2026 15:01
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 13, 2026

📊 Benchmark results

Comparing with 07fa4d1

  • Dependency count: 1,061 (no change)
  • Package size: 357 MB (no change)
  • Number of ts-expect-error directives: 355 (no change)

jaredm563
jaredm563 previously approved these changes Feb 18, 2026
Comment thread src/utils/init/config-manual.ts Outdated
serhalp and others added 5 commits February 23, 2026 13:12
* ci: create integration test sites in testing account

This [mechanism already
exists](https://github.com/netlify/cli/blob/b80b98f85929803fc35a08458c9327dc7ef63de0/tests/integration/utils/create-live-test-site.ts#L22-L36)
but wasn't being used here, so it was falling back to the first account the user has access to that
is returned by the accounts API.

The `netlify-integration-testing` account is properly configured to host our various integration
test sites, e.g. to avoid being rate limited.

* ci: try DEBUG_TESTS=1

* Revert "ci: try DEBUG_TESTS=1"

This reverts commit 2d186bf.

* chore: bump deploy integration test timeout and concurrency
* feat: begin integrating `@netlify/dev`

* chore: add deps

* fix(deps): bump netlify packages to dedupe with @netlify/dev

* chore: update deps

* chore: fix lint issue

* chore: add debug logging

* chore: add comment

Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com>

* chore: cap site name length in tests

* chore: update snapshot

---------

Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com>
* feat: deprecate sites:create-template

* chore: format

* chore: lint

* docs: build docs

* fix: claude says this is how we fix the PR title lint issue

* fix: lol now claude says this will work

* remove this

* remove unneeded issuePrefixes that claude added

* fix: remove a bit more dead code

* fix: remove sites:create-template placeholder cmd

---------

Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com>
@sarahetter sarahetter requested a review from a team as a code owner February 23, 2026 18:12
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 23, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 221d16a0-5633-4276-b1d9-da17db0c0eb7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request changes repo handling in src/utils/init/config-manual.ts: repoPath resolution now uses repoData.repo as an override before calling getRepoPath({ repoData }), and repo.provider is set from repoData.provider with a fallback to 'manual' instead of being hardcoded. It also adds two unit test files: tests/unit/utils/get-repo-data.test.ts (parsing and provider inference for GitHub/GitLab SSH and HTTPS remotes, remote selection, and error cases) and tests/unit/utils/init/config-manual.test.ts (config-manual initialization flows with mocked prompts and Netlify API interactions).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~13 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing GitLab repository handling in the init flow.
Description check ✅ Passed The description directly relates to the changeset by referencing issue #3771 and explaining the GitLab provider fix and webhook display issue being addressed.
Linked Issues check ✅ Passed The code changes directly address issue #3771 by fixing provider resolution to use repoData.provider instead of hardcoded 'manual', enabling correct GitLab webhook display and repository linking.
Out of Scope Changes check ✅ Passed All changes are in-scope: config-manual.ts fixes provider handling, get-repo-data.test.ts adds tests for URL parsing, and config-manual.test.ts validates the provider and repo_path behavior across providers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sarahetter/gitlab

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/unit/utils/get-repo-data.test.ts`:
- Around line 8-119: The tests are self-fulfilling because they construct
RepoData literals and assert those same values; update each spec to call the
real getRepoData function instead of building RepoData objects so
parsing/normalization is exercised. Replace the mockRepoData literals with calls
to getRepoData(...) (or the exported function that returns RepoData) using the
raw git URL/branch/name inputs from each case (e.g.,
'git@github.com:ownername/test.git', 'https://gitlab.com/...', custom host,
etc.), then assert on returnedRepo.httpsUrl, returnedRepo.provider and
returnedRepo.repo to validate behavior. Ensure you import getRepoData and keep
the same expected strings in assertions.

In `@tests/unit/utils/init/config-manual.test.ts`:
- Around line 41-45: The test is failing due to an unsafe direct cast of the
Netlify `config` property; locate the object literal assigned to
`netlify.config` in tests/unit/utils/init/config-manual.test.ts and change the
cast so the provided `{ plugins: [] }` is first cast to `unknown` and then to
the required `CachedConfig['config']` (or BaseCommand['netlify']['config']) type
instead of a direct cast; this preserves the intended test shape while
satisfying TypeScript's structural checks for `build` and other required
properties referenced by `CachedConfig['config']`.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2453221 and ebc8b07.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • src/utils/init/config-manual.ts
  • tests/unit/utils/get-repo-data.test.ts
  • tests/unit/utils/init/config-manual.test.ts

Comment thread tests/unit/utils/get-repo-data.test.ts
Comment thread tests/unit/utils/init/config-manual.test.ts
@serhalp serhalp changed the title feat: fix handling of gitlab repos fix(init): fix handling of gitlab repos Mar 2, 2026
sarahetter and others added 4 commits March 31, 2026 09:46
Rewrite get-repo-data tests to drive the real getRepoData function with
mocked git deps so parsing and provider mapping are actually exercised,
and fix the unsafe direct cast on netlify.config in the config-manual
test by routing it through unknown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sarahetter sarahetter requested a review from a team May 5, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitLab repo URL not being parsed correctly

4 participants