Skip to content

Add Git VCS transformer for GitHub/GitLab repos#14

Draft
AkashS0510 wants to merge 1 commit intomasterfrom
feat/bulk-workflows
Draft

Add Git VCS transformer for GitHub/GitLab repos#14
AkashS0510 wants to merge 1 commit intomasterfrom
feat/bulk-workflows

Conversation

@AkashS0510
Copy link

Summary

  • Adds a new Git VCS transformer (transformer/git-vcs/) that scans GitHub or GitLab organizations for Terraform repositories and generates sg-payload.json for bulk workflow import via sg-cli
  • Installable as a CLI tool (sg-git-scan) — no need to run raw Python scripts
  • Supports monorepo detection (each Terraform directory becomes a separate workflow), cloud provider inference from HCL provider blocks, Terraform version parsing from required_version, and both GitHub and GitLab APIs

What's included

  • sg_git_scan/cli.py — CLI entrypoint with argparse (--provider, --token, --org, etc.)
  • sg_git_scan/vcs.py — Lightweight GitHub/GitLab API clients (Git Trees API, Repository Tree API)
  • sg_git_scan/scanner.py — IaC detection from file trees + HCL parsing (providers, versions, tfvars)
  • sg_git_scan/transform.py — Maps discovered repos/projects to SG workflow payloads
  • example_payload.jsonc — Annotated reference for the output schema
  • README.md — Full usage docs, CLI options, post-generation editing guide
  • Updated top-level README.md to list Git VCS as a supported platform

Usage

cd transformer/git-vcs
pip install .
sg-git-scan --provider github --token ghp_xxx --org my-org
# Edit sg-payload.json as needed, then:
sg-cli workflow create --bulk --org "<ORG>" -- sg-payload.json

… repos

New transformer that scans GitHub/GitLab organizations for Terraform
repositories and generates sg-payload.json for bulk workflow import via
sg-cli. Supports monorepo detection, cloud provider inference, Terraform
version parsing, and both GitHub and GitLab APIs.

Installable as a CLI tool (sg-git-scan) via pip install.
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.

1 participant