# Contributing Back and GitLab Fork Reference — sync-dlt-connectors

Details on contributing fixes back to the monorepo and using alternative git hosts.

## Contributing back to the monorepo

If you fix a bug in a connector while working in a client repo, use `contribute-connector.sh`:

```bash
./contribute-connector.sh google_ads "fix pagination for v2 API"
```

This automatically:
1. Clones the monorepo to a temp directory
2. Copies your modified connector files (excluding `.venv`, secrets, artifacts)
3. Creates a branch, commits, pushes
4. Opens a PR via `gh`

After the PR is merged and auto-tagged (see the dlt-connectors monorepo `auto-tag.yml` GitHub Action), update `connectors.lock.yml`:

```bash
# Check the new tag
git ls-remote --tags git@github.com:Gemma-Analytics/dlt-connectors.git | grep google_ads

# In the client repo — edit connectors.lock.yml -> google_ads/v0.2.0
./sync-connectors.sh google_ads
```

## Using GitLab instead of GitHub for the connectors repo

The `sync-connectors.sh` script uses standard `git clone` — it works with any git server. Simply update the `repo` URL in `connectors.lock.yml` to point to the GitLab fork:

```yaml
# connectors.lock.yml — using GitLab fork
repo: git@gitlab.com:<client_group>/dlt-connectors.git

connectors:
  google_ads:
    version: google_ads/v0.1.0
```

### Workflow with a GitLab fork

1. Fork or mirror `github.com/Gemma-Analytics/dlt-connectors` to `gitlab.com/<client_group>/dlt-connectors`
2. Tags are included in forks automatically — `sync-connectors.sh` works unchanged
3. New tags from the upstream GitHub repo can be pulled into the fork periodically:

   ```bash
   # In the GitLab fork
   git remote add upstream git@github.com:Gemma-Analytics/dlt-connectors.git
   git fetch upstream --tags
   git push origin --tags
   ```

4. Client-specific connectors can be added directly to the fork without contributing back to the central repo

This also works for Bitbucket, self-hosted GitLab, or any git host that supports SSH or HTTPS cloning.

### Example GitLab fork lockfile

```yaml
# connectors.lock.yml — pointing to GitLab fork
repo: git@gitlab.com:acme-corp/dlt-connectors.git

connectors:
  google_ads:
    version: google_ads/v1.2.0
  airtable:
    version: airtable/v1.0.0
```

The same `sync-connectors.sh` script works without modification — it only needs a valid git URL. To keep the fork in sync with upstream:

```bash
# One-time setup in the GitLab fork
git remote add upstream git@github.com:Gemma-Analytics/dlt-connectors.git

# Periodic sync
git fetch upstream --tags
git push origin --tags
```
