Gito is a Swift wrapper for various git commands, designed to work with CI/CD environments. It supports both GitLab and GitHub predefined variables for CI/CD pipelines. A small part of the larger iOS deploy infrastructure at Plata.
- Git status management and validation
- Branch name detection for shallow clones
- Branch stability checking
- Tag management (create, remove, push)
- Commit SHA retrieval
- Remote branch analysis (merged/unmerged)
- Stale branch detection
- CI/CD integration with GitLab and GitHub variables
let gito = Gito()
// Ensure working tree is clean
try gito.ensureGitStatusClean()
...
Gito automatically detects and uses CI/CD environment variables:
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- MR source branchCI_COMMIT_BRANCH
- Push branch nameCI_COMMIT_SHORT_SHA
- Commit SHA
GITHUB_HEAD_REF
- Pull request branchGITHUB_REF
+GITHUB_REF_TYPE
- Push branch referenceGITHUB_SHA
- Commit SHA
- macOS 14.0+
- Swift 6.0+
Add to your Package.swift
:
dependencies: [
.package(url: "https://github.com/platacard/gito.git", from: "1.0.0")
]