Skip to content

Git Module Reference

The git module provides Git-specific origins and destinations.

Basic Git origin:

git.origin(
url = "https://...", # Repository URL
ref = "main", # Branch/tag/commit
submodules = "NO", # "NO", "YES", "RECURSIVE"
first_parent = False, # Follow first parent only
partial_fetch = False, # Enable partial clone
)

GitHub-specific origin:

git.github_origin(
url = "https://github.com/...", # Repository URL
ref = "main", # Branch/tag/commit
review_state = None, # "APPROVED", "CHANGES_REQUESTED"
review_approvers = [], # List of approvers
)

Read from GitHub PRs:

git.github_pr_origin(
url = "https://github.com/...", # Repository URL
branch = "main", # Base branch
state = "OPEN", # "OPEN", "CLOSED", "ALL"
required_labels = [], # Required PR labels
required_status_context_names = [], # Required CI checks
)

Gerrit origin:

git.gerrit_origin(
url = "https://gerrit.../", # Repository URL
ref = "refs/heads/main", # Reference
)

GitHub event trigger:

git.github_trigger(
url = "https://github.com/...", # Repository URL
events = ["pull_request", "push"], # Event types
)

Basic Git destination:

git.destination(
url = "https://...", # Repository URL
push = "main", # Branch to push
fetch = "main", # Branch to fetch (default: push)
tag_name = None, # Optional tag
tag_msg = None, # Tag message
skip_push = False, # Skip push (for testing)
)

GitHub destination:

git.github_destination(
url = "https://github.com/...", # Repository URL
push = "main", # Branch to push
)

Create GitHub PRs:

git.github_pr_destination(
url = "https://github.com/...", # Repository URL
destination_ref = "main", # Target branch
pr_branch = "sync-${REF}", # PR branch name
title = "Sync", # PR title
body = "Description", # PR body
draft = False, # Create as draft
update_description = True, # Update on re-run
assignees = [], # PR assignees
labels = [], # PR labels
)

Gerrit CL destination:

git.gerrit_destination(
url = "https://gerrit.../", # Repository URL
fetch = "main", # Fetch branch
push_to_refs_for = "main", # Target branch
submit = False, # Auto-submit
notify = "ALL", # Notification level
topic = None, # CL topic
)

GitHub API for feedback:

git.github_api(
url = "https://github.com/...", # Repository URL
)

Gerrit API for feedback:

git.gerrit_api(
url = "https://gerrit.../", # Gerrit URL
)

Gerrit review input:

git.review_input(
labels = {"Code-Review": 1}, # Review labels
message = "LGTM", # Review message
)