Temporal-based system for tracking GitHub deployments triggered by Harness pipeline cloud events.
This system orchestrates GitHub deployment creation and status updates using Temporal workflows. It integrates with Harness CI/CD pipelines through an event-driven architecture (EDA) where Harness publishes cloud events that trigger deployment status updates.
- Initial Deployment: Temporal workflow creates GitHub deployment
- Harness Events: Harness pipeline publishes cloud events for different stages
- Status Updates: Cloud events trigger Temporal workflows to update deployment status
pending- CI build startedin_progress- Deployment in progress (shows spinning indicator in GitHub)success- Deployment completed successfullyfailure- Deployment failed
- GitHubDeploymentWorkflow: Creates initial GitHub deployment
- UpdateDeploymentWorkflow: Updates deployment status based on cloud events
- CreateGitHubDeployment: Creates deployment in GitHub via API
- FindGitHubDeployment: Finds existing deployment by repo/commit/environment
- UpdateGitHubDeploymentStatus: Updates deployment status
Environment-based configuration using caarlos0/env:
- GitHub App authentication with dynamic installation ID resolution per organization
- Separate Enterprise and GitHub.com client implementations (no accidental cross-connection)
- Temporal connection settings
- File-based secrets for Kubernetes compatibility
go run worker/main.gogo run test/main.gogo run cmd/update-test/main.goHarness pipelines publish cloud events containing:
{
"github_owner": "owner",
"github_repo": "repo",
"commit_sha": "abc123...",
"environment": "pr-preview",
"state": "in_progress",
"log_url": "https://ci.harness.io/builds/123"
}These events trigger UpdateDeploymentWorkflow which:
- Finds the deployment using repo/commit/environment
- Updates the GitHub deployment status
- Provides visual feedback in GitHub UI
Predefined environment types prevent typos:
config.EnvironmentProductionconfig.EnvironmentStagingconfig.EnvironmentPRPreviewconfig.EnvironmentDevelopmentconfig.EnvironmentTesting
Set environment variables or use .env file:
TEMPORAL_HOST=localhost:7233
TEMPORAL_TASK_QUEUE=github-deployments
GITHUB_APP_ID=319033
GITHUB_ENTERPRISE_URL= # Set to your Enterprise URL (e.g., https://github.mycompany.com)
SECRETS_PATH=.private
See Architecture Documentation for:
- C4 Component diagram showing system boundaries
- High-level sequence diagram of complete flow
- Low-level workflow sequence diagrams
- Temporal Server running on localhost:7233
- GitHub App with deployment permissions
- Go 1.21+