Repository: diggerhq/digger
Pull request #527 (2023-08-25 16:04:25)

introduce lib orchestrator


Patch:
diff --git a/cmd/digger/main.go b/cmd/digger/main.go
index 91fd92ff..4841d241 100644
--- a/cmd/digger/main.go
+++ b/cmd/digger/main.go
@@ -6,12 +6,10 @@ import (
 	"digger/pkg/backend"
 	core_backend "digger/pkg/core/backend"
 	core_locking "digger/pkg/core/locking"
-	"digger/pkg/core/models"
 	core_policy "digger/pkg/core/policy"
 	core_storage "digger/pkg/core/storage"
 	"digger/pkg/digger"
 	"digger/pkg/gcp"
-	dg_github "digger/pkg/github"
 	github_models "digger/pkg/github/models"
 	"digger/pkg/gitlab"
 	"digger/pkg/locking"
@@ -22,6 +20,8 @@ import (
 	"digger/pkg/utils"
 	"fmt"
 	configuration "github.com/diggerhq/lib-digger-config"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
+	dg_github "github.com/diggerhq/lib-orchestrator/github"
 	"gopkg.in/yaml.v3"
 	"log"
 	"net/http"
@@ -123,14 +123,14 @@ func gitHubCI(lock core_locking.Lock, policyChecker core_policy.Checker, backend
 
 		planStorage := newPlanStorage(ghToken, repoOwner, repositoryName, githubActor, nil)
 
-		jobs := models.Job{
+		jobs := orchestrator.Job{
 			ProjectName:       project,
 			ProjectDir:        projectConfig.Dir,
 			ProjectWorkspace:  projectConfig.Workspace,
 			Terragrunt:        projectConfig.Terragrunt,
 			Commands:          []string{command},
-			ApplyStage:        workflow.Apply,
-			PlanStage:         workflow.Plan,
+			ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+			PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 			PullRequestNumber: nil,
 			EventName:         "manual_invocation",
 			RequestedBy:       githubActor,
@@ -152,14 +152,14 @@ func gitHubCI(lock core_locking.Lock, policyChecker core_policy.Checker, backend
 
 			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
 
-			job := models.Job{
+			job := orchestrator.Job{
 				ProjectName:      projectConfig.Name,
 				ProjectDir:       projectConfig.Dir,
 				ProjectWorkspace: projectConfig.Workspace,
 				Terragrunt:       projectConfig.Terragrunt,
 				Commands:         []string{"digger drift-detect"},
-				ApplyStage:       workflow.Apply,
-				PlanStage:        workflow.Plan,
+				ApplyStage:       orchestrator.ToConfigStage(workflow.Apply),
+				PlanStage:        orchestrator.ToConfigStage(workflow.Plan),
 				CommandEnvVars:   commandEnvVars,
 				StateEnvVars:     stateEnvVars,
 				RequestedBy:      githubActor,
@@ -172,7 +172,8 @@ func gitHubCI(lock core_locking.Lock, policyChecker core_policy.Checker, backend
 			}
 		}
 	} else {
-		parsedGhContext, err := github_models.GetGitHubContext(ghContext)
+		parsedGhActionContext, err := github_models.GetGitHubContext(ghContext)
+		parsedGhContext := parsedGhActionContext.ToEventPackage()
 		if err != nil {
 			reportErrorAndExit(githubActor, fmt.Sprintf("Failed to parse GitHub context. %s", err), 3)
 		}
@@ -560,7 +561,7 @@ func logImpactedProjects(projects []configuration.Project, prNumber int) {
 	log.Print(logMessage)
 }
 
-func logCommands(projectCommands []models.Job) {
+func logCommands(projectCommands []orchestrator.Job) {
 	logMessage := fmt.Sprintf("Following commands are going to be executed:\n")
 	for _, pc := range projectCommands {
 		logMessage += fmt.Sprintf("project: %s: commands: ", pc.ProjectName)
diff --git a/go.mod b/go.mod
index a5ad8773..e4a5966e 100644
--- a/go.mod
+++ b/go.mod
@@ -18,7 +18,7 @@ require (
 )
 
 require (
-	github.com/diggerhq/lib-digger-config v0.0.0-20230824131856-20c017537bb3
+	github.com/diggerhq/lib-digger-config v0.0.0-20230824142939-83044a6a36df
 	github.com/dominikbraun/graph v0.23.0
 	github.com/google/go-github/v53 v53.2.0
 	github.com/gruntwork-io/terragrunt v0.36.6
@@ -50,6 +50,7 @@ require (
 	github.com/bmatcuk/doublestar v1.3.1 // indirect
 	github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
 	github.com/creack/pty v1.1.11 // indirect
+	github.com/diggerhq/lib-orchestrator v0.0.0-20230825114620-f51fa4eb2fe3 // indirect
 	github.com/dimchansky/utfbom v1.1.1 // indirect
 	github.com/fatih/color v1.9.0 // indirect
 	github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
diff --git a/go.sum b/go.sum
index 991795b8..ec893615 100644
--- a/go.sum
+++ b/go.sum
@@ -452,6 +452,12 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+
 github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
 github.com/diggerhq/lib-digger-config v0.0.0-20230824131856-20c017537bb3 h1:3EG6wvFBYxCrV5XWqf6bAca8cY4Md8Oz2w6U3Z95lxU=
 github.com/diggerhq/lib-digger-config v0.0.0-20230824131856-20c017537bb3/go.mod h1:AdWua640lLPJJwWe7kZmKP6rk1+ycxxPjd1M4cQJDbs=
+github.com/diggerhq/lib-digger-config v0.0.0-20230824142939-83044a6a36df h1:qgAQe6glZKywACL1qVLDXVpfNUEHzpqFxkWpyqap1xE=
+github.com/diggerhq/lib-digger-config v0.0.0-20230824142939-83044a6a36df/go.mod h1:AdWua640lLPJJwWe7kZmKP6rk1+ycxxPjd1M4cQJDbs=
+github.com/diggerhq/lib-orchestrator v0.0.0-20230825110849-5ea9306e2057 h1:SxYgsaSNrbRxIQ0i0LSf52dinvXn5CZ9PkYmFuW2X30=
+github.com/diggerhq/lib-orchestrator v0.0.0-20230825110849-5ea9306e2057/go.mod h1:+qiBIf8u/UQHpBgxROPCC/rJ1/DcY0HeR/biPu6yt7w=
+github.com/diggerhq/lib-orchestrator v0.0.0-20230825114620-f51fa4eb2fe3 h1:C6syzTVX/AodFt5uUB/HwDeSsyK7uBdBeu4pGDUqVdY=
+github.com/diggerhq/lib-orchestrator v0.0.0-20230825114620-f51fa4eb2fe3/go.mod h1:JBjRXAr8bJQjIIhwmJwbLSSt8xziGFcWVcvAQArYfzs=
 github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
 github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
 github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
@@ -1066,6 +1072,7 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
 github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
+github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
 github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
 github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
diff --git a/pkg/azure/azure.go b/pkg/azure/azure.go
index 5aab9a8e..9c8fe94b 100644
--- a/pkg/azure/azure.go
+++ b/pkg/azure/azure.go
@@ -2,13 +2,12 @@ package azure
 
 import (
 	"context"
-	"digger/pkg/ci"
-	"digger/pkg/core/models"
 	"digger/pkg/utils"
 	"encoding/json"
 	"errors"
 	"fmt"
 	configuration "github.com/diggerhq/lib-digger-config"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"github.com/microsoft/azure-devops-go-api/azuredevops"
 	"github.com/microsoft/azure-devops-go-api/azuredevops/git"
 	"strings"
@@ -331,7 +330,7 @@ func (a *AzureReposService) EditComment(id interface{}, comment string) error {
 	return err
 }
 
-func (a *AzureReposService) GetComments(prNumber int) ([]ci.Comment, error) {
+func (a *AzureReposService) GetComments(prNumber int) ([]orchestrator.Comment, error) {
 	comments, err := a.Client.GetComments(context.Background(), git.GetCommentsArgs{
 		Project:       &a.ProjectName,
 		RepositoryId:  &a.RepositoryId,
@@ -340,9 +339,9 @@ func (a *AzureReposService) GetComments(prNumber int) ([]ci.Comment, error) {
 	if err != nil {
 		return nil, err
 	}
-	var result []ci.Comment
+	var result []orchestrator.Comment
 	for _, comment := range *comments {
-		result = append(result, ci.Comment{
+		result = append(result, orchestrator.Comment{
 			Id:   *comment.Id,
 			Body: comment.Content,
 		})
@@ -351,7 +350,7 @@ func (a *AzureReposService) GetComments(prNumber int) ([]ci.Comment, error) {
 
 }
 
-func ProcessAzureReposEvent(azureEvent interface{}, diggerConfig *configuration.DiggerConfig, ciService ci.PullRequestService) ([]configuration.Project, *configuration.Project, int, error) {
+func ProcessAzureReposEvent(azureEvent interface{}, diggerConfig *configuration.DiggerConfig, ciService orchestrator.PullRequestService) ([]configuration.Project, *configuration.Project, int, error) {
 	var impactedProjects []configuration.Project
 	var prNumber int
 
@@ -393,8 +392,8 @@ func ProcessAzureReposEvent(azureEvent interface{}, diggerConfig *configuration.
 	return impactedProjects, nil, prNumber, nil
 }
 
-func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []configuration.Project, requestedProject *configuration.Project, workflows map[string]configuration.Workflow) ([]models.Job, bool, error) {
-	jobs := make([]models.Job, 0)
+func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []configuration.Project, requestedProject *configuration.Project, workflows map[string]configuration.Workflow) ([]orchestrator.Job, bool, error) {
+	jobs := make([]orchestrator.Job, 0)
 	//&dependencyGraph, diggerProjectNamespace, parsedAzureContext.BaseUrl, parsedAzureContext.EventType, prNumber,
 	switch parseAzureContext.EventType {
 	case AzurePrCreated, AzurePrUpdated, AzurePrReopened:
@@ -406,14 +405,14 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 
 			prNumber := parseAzureContext.Event.(AzurePrEvent).Resource.PullRequestId
 			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-			jobs = append(jobs, models.Job{
+			jobs = append(jobs, orchestrator.Job{
 				ProjectName:       project.Name,
 				ProjectDir:        project.Dir,
 				ProjectWorkspace:  project.Workspace,
 				Terragrunt:        project.Terragrunt,
 				Commands:          workflow.Configuration.OnPullRequestPushed,
-				ApplyStage:        workflow.Apply,
-				PlanStage:         workflow.Plan,
+				ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+				PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 				PullRequestNumber: &prNumber,
 				EventName:         parseAzureContext.EventType,
 				RequestedBy:       parseAzureContext.BaseUrl,
@@ -432,14 +431,14 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 
 			prNumber := parseAzureContext.Event.(AzurePrEvent).Resource.PullRequestId
 			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-			jobs = append(jobs, models.Job{
+			jobs = append(jobs, orchestrator.Job{
 				ProjectName:       project.Name,
 				ProjectDir:        project.Dir,
 				ProjectWorkspace:  project.Workspace,
 				Terragrunt:        project.Terragrunt,
 				Commands:          workflow.Configuration.OnPullRequestClosed,
-				ApplyStage:        workflow.Apply,
-				PlanStage:         workflow.Plan,
+				ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+				PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 				PullRequestNumber: &prNumber,
 				EventName:         parseAzureContext.EventType,
 				RequestedBy:       parseAzureContext.BaseUrl,
@@ -458,14 +457,14 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 					return nil, false, fmt.Errorf("failed to find workflow config '%s' for project '%s'", project.Workflow, project.Name)
 				}
 				stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-				jobs = append(jobs, models.Job{
+				jobs = append(jobs, orchestrator.Job{
 					ProjectName:       project.Name,
 					ProjectDir:        project.Dir,
 					ProjectWorkspace:  project.Workspace,
 					Terragrunt:        project.Terragrunt,
 					Commands:          workflow.Configuration.OnCommitToDefault,
-					ApplyStage:        workflow.Apply,
-					PlanStage:         workflow.Plan,
+					ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+					PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 					PullRequestNumber: &prNumber,
 					EventName:         parseAzureContext.EventType,
 					RequestedBy:       parseAzureContext.BaseUrl,
@@ -499,7 +498,7 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 					workspace := project.Workspace
 					workspaceOverride, err := utils.ParseWorkspace(diggerCommand)
 					if err != nil {
-						return []models.Job{}, coversAllImpactedProjects, err
+						return []orchestrator.Job{}, coversAllImpactedProjects, err
 					}
 					if workspaceOverride != "" {
 						workspace = workspaceOverride
@@ -510,14 +509,14 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 					}
 					stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
 
-					jobs = append(jobs, models.Job{
+					jobs = append(jobs, orchestrator.Job{
 						ProjectName:       project.Name,
 						ProjectDir:        project.Dir,
 						ProjectWorkspace:  workspace,
 						Terragrunt:        project.Terragrunt,
 						Commands:          []string{command},
-						ApplyStage:        workflow.Apply,
-						PlanStage:         workflow.Plan,
+						ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+						PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 						PullRequestNumber: &prNumber,
 						EventName:         parseAzureContext.EventType,
 						RequestedBy:       parseAzureContext.BaseUrl,
@@ -531,6 +530,6 @@ func ConvertAzureEventToCommands(parseAzureContext Azure, impactedProjects []con
 		return jobs, coversAllImpactedProjects, nil
 
 	default:
-		return []models.Job{}, true, fmt.Errorf("unsupported Azure event type: %v", parseAzureContext.EventType)
+		return []orchestrator.Job{}, true, fmt.Errorf("unsupported Azure event type: %v", parseAzureContext.EventType)
 	}
 }
diff --git a/pkg/ci/ci.go b/pkg/ci/ci.go
deleted file mode 100644
index 01975b70..00000000
--- a/pkg/ci/ci.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package ci
-
-type PullRequestService interface {
-	GetChangedFiles(prNumber int) ([]string, error)
-	PublishComment(prNumber int, comment string) error
-	EditComment(id interface{}, comment string) error
-	GetComments(prNumber int) ([]Comment, error)
-	// SetStatus set status of specified pull/merge request, status could be: "pending", "failure", "success"
-	SetStatus(prNumber int, status string, statusContext string) error
-	GetCombinedPullRequestStatus(prNumber int) (string, error)
-	MergePullRequest(prNumber int) error
-	// IsMergeable is still open and ready to be merged
-	IsMergeable(prNumber int) (bool, error)
-	// IsMerged merged and closed
-	IsMerged(prNumber int) (bool, error)
-	// IsClosed closed without merging
-	IsClosed(prNumber int) (bool, error)
-}
-
-type OrgService interface {
-	GetUserTeams(organisation string, user string) ([]string, error)
-}
-
-type Comment struct {
-	Id   interface{}
-	Body *string
-}
diff --git a/pkg/core/execution/execution.go b/pkg/core/execution/execution.go
index 3fb01930..2eeb885b 100644
--- a/pkg/core/execution/execution.go
+++ b/pkg/core/execution/execution.go
@@ -9,6 +9,7 @@ import (
 	"digger/pkg/core/utils"
 	"fmt"
 	configuration "github.com/diggerhq/lib-digger-config"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"log"
 	"os"
 	"path"
@@ -90,8 +91,8 @@ type DiggerExecutor struct {
 	ProjectPath       string
 	StateEnvVars      map[string]string
 	CommandEnvVars    map[string]string
-	ApplyStage        *configuration.Stage
-	PlanStage         *configuration.Stage
+	ApplyStage        *orchestrator.Stage
+	PlanStage         *orchestrator.Stage
 	CommandRunner     runners.CommandRun
 	TerraformExecutor terraform.TerraformExecutor
 	Reporter          reporting.Reporter
@@ -127,12 +128,12 @@ func (d DiggerExecutor) Plan() (bool, bool, string, string, error) {
 	plan := ""
 	terraformPlanOutput := ""
 	isNonEmptyPlan := false
-	var planSteps []configuration.Step
+	var planSteps []orchestrator.Step
 
 	if d.PlanStage != nil {
 		planSteps = d.PlanStage.Steps
 	} else {
-		planSteps = []configuration.Step{
+		planSteps = []orchestrator.Step{
 			{
 				Action: "init",
 			},
@@ -220,12 +221,12 @@ func (d DiggerExecutor) Apply() (bool, string, error) {
 		}
 	}
 
-	var applySteps []configuration.Step
+	var applySteps []orchestrator.Step
 
 	if d.ApplyStage != nil {
 		applySteps = d.ApplyStage.Steps
 	} else {
-		applySteps = []configuration.Step{
+		applySteps = []orchestrator.Step{
 			{
 				Action: "init",
 			},
diff --git a/pkg/core/models/models.go b/pkg/core/models/models.go
index 55828649..d6a05a41 100644
--- a/pkg/core/models/models.go
+++ b/pkg/core/models/models.go
@@ -1,19 +1,2 @@
 package models
 
-import configuration "github.com/diggerhq/lib-digger-config"
-
-type Job struct {
-	ProjectName       string
-	ProjectDir        string
-	ProjectWorkspace  string
-	Terragrunt        bool
-	Commands          []string
-	ApplyStage        *configuration.Stage
-	PlanStage         *configuration.Stage
-	PullRequestNumber *int
-	EventName         string
-	RequestedBy       string
-	Namespace         string
-	StateEnvVars      map[string]string
-	CommandEnvVars    map[string]string
-}
diff --git a/pkg/core/policy/policy.go b/pkg/core/policy/policy.go
index 88eb443c..6f22940c 100644
--- a/pkg/core/policy/policy.go
+++ b/pkg/core/policy/policy.go
@@ -1,6 +1,6 @@
 package policy
 
-import "digger/pkg/ci"
+import orchestrator "github.com/diggerhq/lib-orchestrator"
 
 type Provider interface {
 	GetAccessPolicy(organisation string, repository string, projectname string) (string, error)
@@ -10,7 +10,7 @@ type Provider interface {
 }
 
 type Checker interface {
-	CheckAccessPolicy(ciService ci.OrgService, SCMOrganisation string, SCMrepository string, projectname string, command string, requestedBy string) (bool, error)
+	CheckAccessPolicy(ciService orchestrator.OrgService, SCMOrganisation string, SCMrepository string, projectname string, command string, requestedBy string) (bool, error)
 	CheckPlanPolicy(SCMrepository string, projectname string, planOutput string) (bool, []string, error)
 	CheckDriftPolicy(SCMOrganisation string, SCMrepository string, projectname string) (bool, error)
 }
diff --git a/pkg/digger/digger.go b/pkg/digger/digger.go
index 6263f229..b999343b 100644
--- a/pkg/digger/digger.go
+++ b/pkg/digger/digger.go
@@ -2,11 +2,9 @@ package digger
 
 import (
 	"bytes"
-	"digger/pkg/ci"
 	"digger/pkg/core/backend"
 	"digger/pkg/core/execution"
 	core_locking "digger/pkg/core/locking"
-	"digger/pkg/core/models"
 	"digger/pkg/core/policy"
 	core_reporting "digger/pkg/core/reporting"
 	"digger/pkg/core/runners"
@@ -19,6 +17,7 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"io"
 	"log"
 	"net/http"
@@ -67,9 +66,9 @@ func DetectCI() CIName {
 }
 
 func RunJobs(
-	jobs []models.Job,
-	prService ci.PullRequestService,
-	orgService ci.OrgService,
+	jobs []orchestrator.Job,
+	prService orchestrator.PullRequestService,
+	orgService orchestrator.OrgService,
 	lock core_locking.Lock,
 	reporter core_reporting.Reporter,
 	planStorage storage.PlanStorage,
@@ -133,7 +132,7 @@ func RunJobs(
 	return allAppliesSuccess, atLeastOneApply, nil
 }
 
-func run(command string, job models.Job, policyChecker policy.Checker, orgService ci.OrgService, SCMOrganisation string, SCMrepository string, requestedBy string, reporter core_reporting.Reporter, lock core_locking.Lock, prService ci.PullRequestService, projectNamespace string, workingDir string, planStorage storage.PlanStorage, appliesPerProject map[string]bool) (string, error) {
+func run(command string, job orchestrator.Job, policyChecker policy.Checker, orgService orchestrator.OrgService, SCMOrganisation string, SCMrepository string, requestedBy string, reporter core_reporting.Reporter, lock core_locking.Lock, prService orchestrator.PullRequestService, projectNamespace string, workingDir string, planStorage storage.PlanStorage, appliesPerProject map[string]bool) (string, error) {
 	fmt.Printf("Running '%s' for project '%s'\n", command, job.ProjectName)
 
 	allowedToPerformCommand, err := policyChecker.CheckAccessPolicy(orgService, SCMOrganisation, SCMrepository, job.ProjectName, command, requestedBy)
@@ -356,10 +355,10 @@ func run(command string, job models.Job, policyChecker policy.Checker, orgServic
 }
 
 func RunJob(
-	job models.Job,
+	job orchestrator.Job,
 	projectNamespace string,
 	requestedBy string,
-	orgService ci.OrgService,
+	orgService orchestrator.OrgService,
 	policyChecker policy.Checker,
 	planStorage storage.PlanStorage,
 	backendApi backend.Api,
@@ -590,8 +589,8 @@ func runDriftDetection(policyChecker policy.Checker, SCMOrganisation string, SCM
 	return plan, nil
 }
 
-func SortedCommandsByDependency(project []models.Job, dependencyGraph *graph.Graph[string, string]) []models.Job {
-	var sortedCommands []models.Job
+func SortedCommandsByDependency(project []orchestrator.Job, dependencyGraph *graph.Graph[string, string]) []orchestrator.Job {
+	var sortedCommands []orchestrator.Job
 	sortedGraph, err := graph.StableTopologicalSort(*dependencyGraph, func(s string, s2 string) bool {
 		return s < s2
 	})
@@ -609,7 +608,7 @@ func SortedCommandsByDependency(project []models.Job, dependencyGraph *graph.Gra
 	return sortedCommands
 }
 
-func MergePullRequest(ciService ci.PullRequestService, prNumber int) {
+func MergePullRequest(ciService orchestrator.PullRequestService, prNumber int) {
 	time.Sleep(5 * time.Second)
 
 	// CheckAccessPolicy if it was manually merged
diff --git a/pkg/github/github.go b/pkg/github/github.go
deleted file mode 100644
index 168f58b9..00000000
--- a/pkg/github/github.go
+++ /dev/null
@@ -1,369 +0,0 @@
-package github
-
-import (
-	"context"
-	"digger/pkg/ci"
-	dg_models "digger/pkg/core/models"
-	"digger/pkg/github/models"
-	"digger/pkg/utils"
-	"encoding/json"
-	"fmt"
-	configuration "github.com/diggerhq/lib-digger-config"
-	"log"
-	"strings"
-
-	"github.com/google/go-github/v53/github"
-)
-
-func NewGitHubService(ghToken string, repoName string, owner string) GithubService {
-	client := github.NewTokenClient(context.Background(), ghToken)
-	return GithubService{
-		Client:   client,
-		RepoName: repoName,
-		Owner:    owner,
-	}
-}
-
-type GithubService struct {
-	Client   *github.Client
-	RepoName string
-	Owner    string
-}
-
-func (svc *GithubService) GetUserTeams(organisation string, user string) ([]string, error) {
-	teamsResponse, _, err := svc.Client.Teams.ListTeams(context.Background(), organisation, nil)
-	if err != nil {
-		log.Fatalf("Failed to list github teams: %v", err)
-	}
-	var teams []string
-	for _, team := range teamsResponse {
-		teamMembers, _, _ := svc.Client.Teams.ListTeamMembersBySlug(context.Background(), organisation, *team.Slug, nil)
-		for _, member := range teamMembers {
-			if *member.Login == user {
-				teams = append(teams, *team.Name)
-				break
-			}
-		}
-	}
-
-	return teams, nil
-}
-
-func (svc *GithubService) GetChangedFiles(prNumber int) ([]string, error) {
-	files, _, err := svc.Client.PullRequests.ListFiles(context.Background(), svc.Owner, svc.RepoName, prNumber, nil)
-	if err != nil {
-		log.Fatalf("error getting pull request files: %v", err)
-	}
-
-	fileNames := make([]string, len(files))
-
-	for i, file := range files {
-		fileNames[i] = *file.Filename
-	}
-	return fileNames, nil
-}
-
-func (svc *GithubService) PublishComment(prNumber int, comment string) error {
-	_, _, err := svc.Client.Issues.CreateComment(context.Background(), svc.Owner, svc.RepoName, prNumber, &github.IssueComment{Body: &comment})
-	return err
-}
-
-func (svc *GithubService) GetComments(prNumber int) ([]ci.Comment, error) {
-	comments, _, err := svc.Client.Issues.ListComments(context.Background(), svc.Owner, svc.RepoName, prNumber, &github.IssueListCommentsOptions{ListOptions: github.ListOptions{PerPage: 100}})
-	commentBodies := make([]ci.Comment, len(comments))
-	for i, comment := range comments {
-		commentBodies[i] = ci.Comment{
-			Id:   *comment.ID,
-			Body: comment.Body,
-		}
-	}
-	return commentBodies, err
-}
-
-func (svc *GithubService) EditComment(id interface{}, comment string) error {
-	commentId := id.(int64)
-	_, _, err := svc.Client.Issues.EditComment(context.Background(), svc.Owner, svc.RepoName, commentId, &github.IssueComment{Body: &comment})
-	return err
-}
-
-func (svc *GithubService) SetStatus(prNumber int, status string, statusContext string) error {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-	}
-
-	_, _, err = svc.Client.Repositories.CreateStatus(context.Background(), svc.Owner, svc.RepoName, *pr.Head.SHA, &github.RepoStatus{
-		State:       &status,
-		Context:     &statusContext,
-		Description: &statusContext,
-	})
-	return err
-}
-
-func (svc *GithubService) GetCombinedPullRequestStatus(prNumber int) (string, error) {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-	}
-
-	statuses, _, err := svc.Client.Repositories.GetCombinedStatus(context.Background(), svc.Owner, svc.RepoName, pr.Head.GetSHA(), nil)
-	if err != nil {
-		log.Fatalf("error getting combined status: %v", err)
-	}
-
-	return *statuses.State, nil
-}
-
-func (svc *GithubService) MergePullRequest(prNumber int) error {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-	}
-
-	_, _, err = svc.Client.PullRequests.Merge(context.Background(), svc.Owner, svc.RepoName, prNumber, "auto-merge", &github.PullRequestOptions{
-		MergeMethod: "squash",
-		SHA:         pr.Head.GetSHA(),
-	})
-	return err
-}
-
-func isMergeableState(mergeableState string) bool {
-	// https://docs.github.com/en/github-ae@latest/graphql/reference/enums#mergestatestatus
-	mergeableStates := map[string]int{
-		"clean":     0,
-		"unstable":  0,
-		"has_hooks": 1,
-	}
-	_, exists := mergeableStates[strings.ToLower(mergeableState)]
-	if !exists {
-		log.Printf("pr.GetMergeableState() returned: %v", mergeableState)
-	}
-
-	return exists
-}
-
-func (svc *GithubService) IsMergeable(prNumber int) (bool, error) {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-		return false, err
-	}
-
-	return pr.GetMergeable() && isMergeableState(pr.GetMergeableState()), nil
-}
-
-func (svc *GithubService) IsMerged(prNumber int) (bool, error) {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-		return false, err
-	}
-	return *pr.Merged, nil
-}
-
-func (svc *GithubService) IsClosed(prNumber int) (bool, error) {
-	pr, _, err := svc.Client.PullRequests.Get(context.Background(), svc.Owner, svc.RepoName, prNumber)
-	if err != nil {
-		log.Fatalf("error getting pull request: %v", err)
-		return false, err
-	}
-
-	return pr.GetState() == "closed", nil
-}
-
-func GetGitHubContext(ghContext string) (*models.Github, error) {
-	parsedGhContext := new(models.Github)
-	err := json.Unmarshal([]byte(ghContext), &parsedGhContext)
-	if err != nil {
-		return &models.Github{}, fmt.Errorf("error parsing GitHub context JSON: %v", err)
-	}
-	return parsedGhContext, nil
-}
-
-func ConvertGithubEventToJobs(parsedGhContext models.Github, impactedProjects []configuration.Project, requestedProject *configuration.Project, workflows map[string]configuration.Workflow) ([]dg_models.Job, bool, error) {
-	jobs := make([]dg_models.Job, 0)
-
-	switch parsedGhContext.Event.(type) {
-	case models.PullRequestEvent:
-		event := parsedGhContext.Event.(models.PullRequestEvent)
-		for _, project := range impactedProjects {
-			workflow, ok := workflows[project.Workflow]
-			if !ok {
-				return nil, false, fmt.Errorf("failed to find workflow config '%s' for project '%s'", project.Workflow, project.Name)
-			}
-
-			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-
-			if event.Action == "closed" && event.PullRequest.Merged && event.PullRequest.Base.Ref == event.Repository.DefaultBranch {
-				jobs = append(jobs, dg_models.Job{
-					ProjectName:       project.Name,
-					ProjectDir:        project.Dir,
-					ProjectWorkspace:  project.Workspace,
-					Terragrunt:        project.Terragrunt,
-					Commands:          workflow.Configuration.OnCommitToDefault,
-					ApplyStage:        workflow.Apply,
-					PlanStage:         workflow.Plan,
-					CommandEnvVars:    commandEnvVars,
-					StateEnvVars:      stateEnvVars,
-					PullRequestNumber: &event.PullRequest.Number,
-					EventName:         "pull_request",
-					RequestedBy:       parsedGhContext.Actor,
-					Namespace:         parsedGhContext.Repository,
-				})
-			} else if event.Action == "opened" || event.Action == "reopened" || event.Action == "synchronize" {
-				jobs = append(jobs, dg_models.Job{
-					ProjectName:       project.Name,
-					ProjectDir:        project.Dir,
-					ProjectWorkspace:  project.Workspace,
-					Terragrunt:        project.Terragrunt,
-					Commands:          workflow.Configuration.OnPullRequestPushed,
-					ApplyStage:        workflow.Apply,
-					PlanStage:         workflow.Plan,
-					CommandEnvVars:    commandEnvVars,
-					StateEnvVars:      stateEnvVars,
-					PullRequestNumber: &event.PullRequest.Number,
-					EventName:         "pull_request",
-					Namespace:         parsedGhContext.Repository,
-					RequestedBy:       parsedGhContext.Actor,
-				})
-			} else if event.Action == "closed" {
-				jobs = append(jobs, dg_models.Job{
-					ProjectName:       project.Name,
-					ProjectDir:        project.Dir,
-					ProjectWorkspace:  project.Workspace,
-					Terragrunt:        project.Terragrunt,
-					Commands:          workflow.Configuration.OnPullRequestClosed,
-					ApplyStage:        workflow.Apply,
-					PlanStage:         workflow.Plan,
-					CommandEnvVars:    commandEnvVars,
-					StateEnvVars:      stateEnvVars,
-					PullRequestNumber: &event.PullRequest.Number,
-					EventName:         "pull_request",
-					Namespace:         parsedGhContext.Repository,
-					RequestedBy:       parsedGhContext.Actor,
-				})
-			}
-		}
-		return jobs, true, nil
-	case models.IssueCommentEvent:
-		event := parsedGhContext.Event.(models.IssueCommentEvent)
-		supportedCommands := []string{"digger plan", "digger apply", "digger unlock", "digger lock"}
-
-		coversAllImpactedProjects := true
-
-		runForProjects := impactedProjects
-
-		if requestedProject != nil {
-			if len(impactedProjects) > 1 {
-				coversAllImpactedProjects = false
-				runForProjects = []configuration.Project{*requestedProject}
-			} else if len(impactedProjects) == 1 && impactedProjects[0].Name != requestedProject.Name {
-				return jobs, false, fmt.Errorf("requested project %v is not impacted by this PR", requestedProject.Name)
-			}
-		}
-
-		diggerCommand := strings.ToLower(event.Comment.Body)
-		diggerCommand = strings.TrimSpace(diggerCommand)
-
-		for _, command := range supportedCommands {
-			if strings.HasPrefix(diggerCommand, command) {
-				for _, project := range runForProjects {
-					workflow, ok := workflows[project.Workflow]
-					if !ok {
-						return nil, false, fmt.Errorf("failed to find workflow config '%s' for project '%s'", project.Workflow, project.Name)
-					}
-
-					stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-
-					workspace := project.Workspace
-					workspaceOverride, err := utils.ParseWorkspace(event.Comment.Body)
-					if err != nil {
-						return []dg_models.Job{}, false, err
-					}
-					if workspaceOverride != "" {
-						workspace = workspaceOverride
-					}
-					jobs = append(jobs, dg_models.Job{
-						ProjectName:       project.Name,
-						ProjectDir:        project.Dir,
-						ProjectWorkspace:  workspace,
-						Terragrunt:        project.Terragrunt,
-						Commands:          []string{command},
-						ApplyStage:        workflow.Apply,
-						PlanStage:         workflow.Plan,
-						CommandEnvVars:    commandEnvVars,
-						StateEnvVars:      stateEnvVars,
-						PullRequestNumber: &event.Issue.Number,
-						EventName:         "issue_comment",
-						RequestedBy:       parsedGhContext.Actor,
-						Namespace:         parsedGhContext.Repository,
-					})
-				}
-			}
-		}
-		return jobs, coversAllImpactedProjects, nil
-	default:
-		return []dg_models.Job{}, false, fmt.Errorf("unsupported event type: %T", parsedGhContext.EventName)
-	}
-}
-
-func ProcessGitHubEvent(ghEvent models.Event, diggerConfig *configuration.DiggerConfig, ciService ci.PullRequestService) ([]configuration.Project, *configuration.Project, int, error) {
-	var impactedProjects []configuration.Project
-	var prNumber int
-
-	switch ghEvent.(type) {
-	case models.PullRequestEvent:
-		prNumber = ghEvent.(models.PullRequestEvent).PullRequest.Number
-		changedFiles, err := ciService.GetChangedFiles(prNumber)
-
-		if err != nil {
-			return nil, nil, 0, fmt.Errorf("could not get changed files")
-		}
-
-		impactedProjects = diggerConfig.GetModifiedProjects(changedFiles)
-	case models.IssueCommentEvent:
-		prNumber = ghEvent.(models.IssueCommentEvent).Issue.Number
-		changedFiles, err := ciService.GetChangedFiles(prNumber)
-
-		if err != nil {
-			return nil, nil, 0, fmt.Errorf("could not get changed files")
-		}
-
-		impactedProjects = diggerConfig.GetModifiedProjects(changedFiles)
-		requestedProject := utils.ParseProjectName(ghEvent.(models.IssueCommentEvent).Comment.Body)
-
-		if requestedProject == "" {
-			return impactedProjects, nil, prNumber, nil
-		}
-
-		for _, project := range impactedProjects {
-			if project.Name == requestedProject {
-				return impactedProjects, &project, prNumber, nil
-			}
-		}
-		return nil, nil, 0, fmt.Errorf("requested project not found in modified projects")
-
-	default:
-		return nil, nil, 0, fmt.Errorf("unsupported event type")
-	}
-	return impactedProjects, nil, prNumber, nil
-}
-
-func issueCommentEventContainsComment(event models.Event, comment string) bool {
-	switch event.(type) {
-	case models.IssueCommentEvent:
-		event := event.(models.IssueCommentEvent)
-		if strings.Contains(event.Comment.Body, comment) {
-			return true
-		}
-	}
-	return false
-}
-
-func CheckIfHelpComment(event models.Event) bool {
-	return issueCommentEventContainsComment(event, "digger help")
-}
-
-func CheckIfApplyComment(event models.Event) bool {
-	return issueCommentEventContainsComment(event, "digger apply")
-}
diff --git a/pkg/github/models/models.go b/pkg/github/models/models.go
index 8c9c25e1..a3e1a37f 100644
--- a/pkg/github/models/models.go
+++ b/pkg/github/models/models.go
@@ -4,30 +4,38 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/diggerhq/lib-orchestrator/github/models"
+	"github.com/google/go-github/v53/github"
 )
 
-type Github struct {
-	Action           string `json:"action"`
-	ActionPath       string `json:"action_path"`
-	ActionRef        string `json:"action_ref"`
-	ActionRepository string `json:"action_repository"`
-	ActionStatus     string `json:"action_status"`
-	Actor            string `json:"actor"`
-	BaseRef          string `json:"base_ref"`
-	Env              string `json:"env"`
-	Event            Event  `json:"event"`
-	EventName        string `json:"event_name"`
-	EventPath        string `json:"event_path"`
-	Path             string `json:"path"`
-	RefType          string `json:"ref_type"`
-	Repository       string `json:"repository"`
-	RepositoryOwner  string `json:"repository_owner"`
+type GithubAction struct {
+	Action           string      `json:"action"`
+	ActionPath       string      `json:"action_path"`
+	ActionRef        string      `json:"action_ref"`
+	ActionRepository string      `json:"action_repository"`
+	ActionStatus     string      `json:"action_status"`
+	Actor            string      `json:"actor"`
+	BaseRef          string      `json:"base_ref"`
+	Env              string      `json:"env"`
+	Event            interface{} `json:"event"`
+	EventName        string      `json:"event_name"`
+	EventPath        string      `json:"event_path"`
+	Path             string      `json:"path"`
+	RefType          string      `json:"ref_type"`
+	Repository       string      `json:"repository"`
+	RepositoryOwner  string      `json:"repository_owner"`
 }
 
-type Event interface{}
-
-func (g *Github) UnmarshalJSON(data []byte) error {
-	type Alias Github
+func (g *GithubAction) ToEventPackage() models.EventPackage {
+	return models.EventPackage{
+		Event:      g.Event,
+		EventName:  g.EventName,
+		Actor:      g.Actor,
+		Repository: g.Repository,
+	}
+}
+func (g *GithubAction) UnmarshalJSON(data []byte) error {
+	type Alias GithubAction
 	aux := struct {
 		*Alias
 	}{
@@ -49,25 +57,25 @@ func (g *Github) UnmarshalJSON(data []byte) error {
 
 	switch g.EventName {
 	case "pull_request":
-		var event PullRequestEvent
+		var event github.PullRequestEvent
 		if err := json.Unmarshal(rawEvent, &event); err != nil {
 			return err
 		}
 		g.Event = event
 	case "issue_comment":
-		var event IssueCommentEvent
+		var event github.IssueCommentEvent
 		if err := json.Unmarshal(rawEvent, &event); err != nil {
 			return err
 		}
 		g.Event = event
 	case "push":
-		var event PushEvent
+		var event github.PushEvent
 		if err := json.Unmarshal(rawEvent, &event); err != nil {
 			return err
 		}
 		g.Event = event
 	case "workflow_dispatch":
-		var event WorkflowDispatchEvent
+		var event github.WorkflowDispatchEvent
 		if err := json.Unmarshal(rawEvent, &event); err != nil {
 			return err
 		}
@@ -79,53 +87,11 @@ func (g *Github) UnmarshalJSON(data []byte) error {
 	return nil
 }
 
-type PullRequestEvent struct {
-	Action      string      `json:"action"`
-	Number      int         `json:"number"`
-	PullRequest PullRequest `json:"pull_request"`
-	Repository  Repository  `json:"repository"`
-}
-
-type PullRequest struct {
-	Number int  `json:"number"`
-	Merged bool `json:"merged"`
-	Base   Base `json:"base"`
-}
-
-type PushEvent struct {
-}
-
-type IssueCommentEvent struct {
-	Action  string  `json:"action"`
-	Comment Comment `json:"comment"`
-	Issue   Issue   `json:"issue"`
-}
-
-type WorkflowDispatchEvent struct {
-	Inputs map[string]string `json:"inputs"`
-}
-
-type Base struct {
-	Ref string `json:"ref"`
-}
-
-type Comment struct {
-	Body string `json:"body"`
-}
-
-type Issue struct {
-	Number int `json:"number"`
-}
-
-type Repository struct {
-	DefaultBranch string `json:"default_branch"`
-}
-
-func GetGitHubContext(ghContext string) (Github, error) {
-	var parsedGhContext Github
+func GetGitHubContext(ghContext string) (*GithubAction, error) {
+	parsedGhContext := new(GithubAction)
 	err := json.Unmarshal([]byte(ghContext), &parsedGhContext)
 	if err != nil {
-		return Github{}, fmt.Errorf("error parsing GitHub context JSON: %v", err)
+		return &GithubAction{}, fmt.Errorf("error parsing GitHub context JSON: %v", err)
 	}
 	return parsedGhContext, nil
 }
diff --git a/pkg/gitlab/gitlab.go b/pkg/gitlab/gitlab.go
index beb07ffe..8b47c600 100644
--- a/pkg/gitlab/gitlab.go
+++ b/pkg/gitlab/gitlab.go
@@ -1,11 +1,10 @@
 package gitlab
 
 import (
-	"digger/pkg/ci"
-	"digger/pkg/core/models"
 	"digger/pkg/utils"
 	"fmt"
 	configuration "github.com/diggerhq/lib-digger-config"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"log"
 	"strings"
 
@@ -234,7 +233,7 @@ func (gitlabService GitLabService) EditComment(id interface{}, comment string) e
 	return nil
 }
 
-func (gitlabService GitLabService) GetComments(prNumber int) ([]ci.Comment, error) {
+func (gitlabService GitLabService) GetComments(prNumber int) ([]orchestrator.Comment, error) {
 	//TODO implement me
 	return nil, nil
 }
@@ -276,8 +275,8 @@ const (
 	MergeRequestComment = GitLabEventType("merge_request_commented")
 )
 
-func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContext, impactedProjects []configuration.Project, requestedProject *configuration.Project, workflows map[string]configuration.Workflow) ([]models.Job, bool, error) {
-	jobs := make([]models.Job, 0)
+func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContext, impactedProjects []configuration.Project, requestedProject *configuration.Project, workflows map[string]configuration.Workflow) ([]orchestrator.Job, bool, error) {
+	jobs := make([]orchestrator.Job, 0)
 
 	fmt.Printf("ConvertGitLabEventToCommands, event.EventType: %s\n", event.EventType)
 	switch event.EventType {
@@ -289,14 +288,14 @@ func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContex
 			}
 
 			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-			jobs = append(jobs, models.Job{
+			jobs = append(jobs, orchestrator.Job{
 				ProjectName:       project.Name,
 				ProjectDir:        project.Dir,
 				ProjectWorkspace:  project.Workspace,
 				Terragrunt:        project.Terragrunt,
 				Commands:          workflow.Configuration.OnPullRequestPushed,
-				ApplyStage:        workflow.Apply,
-				PlanStage:         workflow.Plan,
+				ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+				PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 				PullRequestNumber: gitLabContext.MergeRequestIId,
 				EventName:         gitLabContext.EventType.String(),
 				RequestedBy:       gitLabContext.GitlabUserName,
@@ -313,14 +312,14 @@ func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContex
 				return nil, true, fmt.Errorf("failed to find workflow config '%s' for project '%s'", project.Workflow, project.Name)
 			}
 			stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-			jobs = append(jobs, models.Job{
+			jobs = append(jobs, orchestrator.Job{
 				ProjectName:       project.Name,
 				ProjectDir:        project.Dir,
 				ProjectWorkspace:  project.Workspace,
 				Terragrunt:        project.Terragrunt,
 				Commands:          workflow.Configuration.OnPullRequestClosed,
-				ApplyStage:        workflow.Apply,
-				PlanStage:         workflow.Plan,
+				ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+				PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 				PullRequestNumber: gitLabContext.MergeRequestIId,
 				EventName:         gitLabContext.EventType.String(),
 				RequestedBy:       gitLabContext.GitlabUserName,
@@ -358,20 +357,20 @@ func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContex
 					workspace := project.Workspace
 					workspaceOverride, err := utils.ParseWorkspace(diggerCommand)
 					if err != nil {
-						return []models.Job{}, false, err
+						return []orchestrator.Job{}, false, err
 					}
 					if workspaceOverride != "" {
 						workspace = workspaceOverride
 					}
 					stateEnvVars, commandEnvVars := configuration.CollectTerraformEnvConfig(workflow.EnvVars)
-					jobs = append(jobs, models.Job{
+					jobs = append(jobs, orchestrator.Job{
 						ProjectName:       project.Name,
 						ProjectDir:        project.Dir,
 						ProjectWorkspace:  workspace,
 						Terragrunt:        project.Terragrunt,
 						Commands:          []string{command},
-						ApplyStage:        workflow.Apply,
-						PlanStage:         workflow.Plan,
+						ApplyStage:        orchestrator.ToConfigStage(workflow.Apply),
+						PlanStage:         orchestrator.ToConfigStage(workflow.Plan),
 						PullRequestNumber: gitLabContext.MergeRequestIId,
 						EventName:         gitLabContext.EventType.String(),
 						RequestedBy:       gitLabContext.GitlabUserName,
@@ -385,6 +384,6 @@ func ConvertGitLabEventToCommands(event GitLabEvent, gitLabContext *GitLabContex
 		return jobs, coversAllImpactedProjects, nil
 
 	default:
-		return []models.Job{}, false, fmt.Errorf("unsupported GitLab event type: %v", event)
+		return []orchestrator.Job{}, false, fmt.Errorf("unsupported GitLab event type: %v", event)
 	}
 }
diff --git a/pkg/locking/locking.go b/pkg/locking/locking.go
index 471e0752..49b78e43 100644
--- a/pkg/locking/locking.go
+++ b/pkg/locking/locking.go
@@ -4,13 +4,13 @@ import (
 	"digger/pkg/aws"
 	"digger/pkg/aws/envprovider"
 	"digger/pkg/azure"
-	"digger/pkg/ci"
 	"digger/pkg/core/locking"
 	"digger/pkg/core/reporting"
 	"digger/pkg/core/utils"
 	"digger/pkg/gcp"
 	"errors"
 	"fmt"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"log"
 	"os"
 	"strconv"
@@ -27,7 +27,7 @@ import (
 
 type PullRequestLock struct {
 	InternalLock     locking.Lock
-	CIService        ci.PullRequestService
+	CIService        orchestrator.PullRequestService
 	Reporter         reporting.Reporter
 	ProjectName      string
 	ProjectNamespace string
diff --git a/pkg/policy/policy.go b/pkg/policy/policy.go
index 4996d838..e25e54d8 100644
--- a/pkg/policy/policy.go
+++ b/pkg/policy/policy.go
@@ -2,11 +2,11 @@ package policy
 
 import (
 	"context"
-	"digger/pkg/ci"
 	"digger/pkg/core/policy"
 	"encoding/json"
 	"errors"
 	"fmt"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"github.com/open-policy-agent/opa/rego"
 	"io"
 	"log"
@@ -24,7 +24,7 @@ type DiggerHttpPolicyProvider struct {
 type NoOpPolicyChecker struct {
 }
 
-func (p NoOpPolicyChecker) CheckAccessPolicy(_ ci.OrgService, _ string, _ string, _ string, _ string, _ string) (bool, error) {
+func (p NoOpPolicyChecker) CheckAccessPolicy(_ orchestrator.OrgService, _ string, _ string, _ string, _ string, _ string) (bool, error) {
 	return true, nil
 }
 
@@ -252,7 +252,7 @@ type DiggerPolicyChecker struct {
 	PolicyProvider policy.Provider
 }
 
-func (p DiggerPolicyChecker) CheckAccessPolicy(ciService ci.OrgService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
+func (p DiggerPolicyChecker) CheckAccessPolicy(ciService orchestrator.OrgService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
 
 	policy, err := p.PolicyProvider.GetAccessPolicy(SCMOrganisation, SCMrepository, projectName)
 
diff --git a/pkg/reporting/reporting.go b/pkg/reporting/reporting.go
index bc30c87e..807e6104 100644
--- a/pkg/reporting/reporting.go
+++ b/pkg/reporting/reporting.go
@@ -1,15 +1,15 @@
 package reporting
 
 import (
-	"digger/pkg/ci"
 	"digger/pkg/core/utils"
 	"fmt"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"strings"
 	"time"
 )
 
 type CiReporter struct {
-	CiService      ci.PullRequestService
+	CiService      orchestrator.PullRequestService
 	PrNumber       int
 	ReportStrategy ReportStrategy
 }
@@ -26,14 +26,14 @@ func (reporter *StdOutReporter) Report(report string, reportFormatter func(repor
 }
 
 type ReportStrategy interface {
-	Report(ciService ci.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string) error
+	Report(ciService orchestrator.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string) error
 }
 
 type CommentPerRunStrategy struct {
 	TimeOfRun time.Time
 }
 
-func (strategy *CommentPerRunStrategy) Report(ciService ci.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string) error {
+func (strategy *CommentPerRunStrategy) Report(ciService orchestrator.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string) error {
 	comments, err := ciService.GetComments(PrNumber)
 	if err != nil {
 		return fmt.Errorf("error getting comments: %v", err)
@@ -43,7 +43,7 @@ func (strategy *CommentPerRunStrategy) Report(ciService ci.PullRequestService, P
 	return upsertComment(ciService, PrNumber, report, reportFormatter, comments, reportTitle, err)
 }
 
-func upsertComment(ciService ci.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string, comments []ci.Comment, reportTitle string, err error) error {
+func upsertComment(ciService orchestrator.PullRequestService, PrNumber int, report string, reportFormatter func(report string) string, comments []orchestrator.Comment, reportTitle string, err error) error {
 	report = reportFormatter(report)
 	var commentIdForThisRun interface{}
 	var commentBody string
@@ -85,7 +85,7 @@ type LatestRunCommentStrategy struct {
 	TimeOfRun time.Time
 }
 
-func (strategy *LatestRunCommentStrategy) Report(ciService ci.PullRequestService, prNumber int, comment string, commentFormatting func(comment string) string) error {
+func (strategy *LatestRunCommentStrategy) Report(ciService orchestrator.PullRequestService, prNumber int, comment string, commentFormatting func(comment string) string) error {
 	comments, err := ciService.GetComments(prNumber)
 	if err != nil {
 		return fmt.Errorf("error getting comments: %v", err)
@@ -97,6 +97,6 @@ func (strategy *LatestRunCommentStrategy) Report(ciService ci.PullRequestService
 
 type MultipleCommentsStrategy struct{}
 
-func (strategy *MultipleCommentsStrategy) Report(ciService ci.PullRequestService, PrNumber int, report string, formatter func(string) string) error {
+func (strategy *MultipleCommentsStrategy) Report(ciService orchestrator.PullRequestService, PrNumber int, report string, formatter func(string) string) error {
 	return ciService.PublishComment(PrNumber, formatter(report))
 }
diff --git a/pkg/utils/commands.go b/pkg/utils/commands.go
index 21e6cd9b..7fed23c1 100644
--- a/pkg/utils/commands.go
+++ b/pkg/utils/commands.go
@@ -36,6 +36,7 @@ func GetCommands() string {
 	return commands
 }
 
+// TODO move func to lib-orchestrator library after gitlab and azure moves there
 func ParseProjectName(comment string) string {
 	re := regexp.MustCompile(`-p ([0-9a-zA-Z\-_]+)`)
 	match := re.FindStringSubmatch(comment)
@@ -45,6 +46,7 @@ func ParseProjectName(comment string) string {
 	return ""
 }
 
+// TODO move func to lib-orchestrator library after gitlab and azure moves there
 func ParseWorkspace(comment string) (string, error) {
 	re := regexp.MustCompile(`-w(?:\s+(\S+)|$)`)
 	matches := re.FindAllStringSubmatch(comment, -1)
diff --git a/pkg/utils/mocks.go b/pkg/utils/mocks.go
index ea109462..94d23078 100644
--- a/pkg/utils/mocks.go
+++ b/pkg/utils/mocks.go
@@ -1,7 +1,7 @@
 package utils
 
 import (
-	"digger/pkg/ci"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"time"
 )
 
@@ -47,7 +47,7 @@ func (lock *MockLock) GetLock(resource string) (*int, error) {
 type MockPolicyChecker struct {
 }
 
-func (t MockPolicyChecker) CheckAccessPolicy(ciService ci.OrgService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
+func (t MockPolicyChecker) CheckAccessPolicy(ciService orchestrator.OrgService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
 	return false, nil
 }
 
@@ -103,8 +103,8 @@ func (t MockPullRequestManager) IsClosed(prNumber int) (bool, error) {
 	return false, nil
 }
 
-func (t MockPullRequestManager) GetComments(prNumber int) ([]ci.Comment, error) {
-	return []ci.Comment{}, nil
+func (t MockPullRequestManager) GetComments(prNumber int) ([]orchestrator.Comment, error) {
+	return []orchestrator.Comment{}, nil
 }
 
 func (t MockPullRequestManager) EditComment(commentId interface{}, comment string) error {
diff --git a/pkg/utils/pullrequestmanager_mock.go b/pkg/utils/pullrequestmanager_mock.go
index 66e09cfb..9f0e860d 100644
--- a/pkg/utils/pullrequestmanager_mock.go
+++ b/pkg/utils/pullrequestmanager_mock.go
@@ -1,6 +1,6 @@
 package utils
 
-import "digger/pkg/ci"
+import orchestrator "github.com/diggerhq/lib-orchestrator"
 
 type MockReporter struct {
 	commands []string
@@ -64,9 +64,9 @@ func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsMerged(prNum
 	return false, nil
 }
 
-func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetComments(prNumber int) ([]ci.Comment, error) {
+func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetComments(prNumber int) ([]orchestrator.Comment, error) {
 	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetComments")
-	return []ci.Comment{}, nil
+	return []orchestrator.Comment{}, nil
 }
 
 func (mockGithubPullrequestManager *MockGithubPullrequestManager) EditComment(commentId interface{}, comment string) error {


Test patch:
diff --git a/cmd/digger/main_test.go b/cmd/digger/main_test.go
index 535fd496..54bf8174 100644
--- a/cmd/digger/main_test.go
+++ b/cmd/digger/main_test.go
@@ -2,11 +2,15 @@ package main
 
 import (
 	"digger/pkg/digger"
-	"digger/pkg/github"
-	gh_models "digger/pkg/github/models"
+	"digger/pkg/github/models"
+	ghmodels "digger/pkg/github/models"
 	"digger/pkg/reporting"
 	"digger/pkg/utils"
 	"fmt"
+	dggithub "github.com/diggerhq/lib-orchestrator/github"
+	dggithubmodels "github.com/diggerhq/lib-orchestrator/github/models"
+	"github.com/google/go-github/v53/github"
+
 	configuration "github.com/diggerhq/lib-digger-config"
 	"testing"
 
@@ -865,7 +869,9 @@ var githubInvalidContextJson = `{
 
 func TestGitHubNewPullRequestContext(t *testing.T) {
 
-	context, err := github.GetGitHubContext(githubContextNewPullRequestJson)
+	actionContext, err := models.GetGitHubContext(githubContextNewPullRequestJson)
+	context := actionContext.ToEventPackage()
+
 	assert.NoError(t, err)
 	if err != nil {
 		fmt.Println(err)
@@ -879,13 +885,13 @@ func TestGitHubNewPullRequestContext(t *testing.T) {
 	policyChecker := &utils.MockPolicyChecker{}
 	backendApi := &utils.MockBackendApi{}
 
-	impactedProjects, requestedProject, prNumber, err := github.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
+	impactedProjects, requestedProject, prNumber, err := dggithub.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
 
 	reporter := &reporting.CiReporter{
 		CiService: prManager,
 		PrNumber:  prNumber,
 	}
-	jobs, _, err := github.ConvertGithubEventToJobs(*context, impactedProjects, requestedProject, map[string]configuration.Workflow{})
+	jobs, _, err := dggithub.ConvertGithubEventToJobs(context, impactedProjects, requestedProject, map[string]configuration.Workflow{})
 	_, _, err = digger.RunJobs(jobs, prManager, prManager, lock, reporter, planStorage, policyChecker, backendApi, "")
 
 	assert.NoError(t, err)
@@ -895,7 +901,8 @@ func TestGitHubNewPullRequestContext(t *testing.T) {
 }
 
 func TestGitHubNewCommentContext(t *testing.T) {
-	context, err := gh_models.GetGitHubContext(githubContextCommentJson)
+	actionContext, err := ghmodels.GetGitHubContext(githubContextCommentJson)
+	context := actionContext.ToEventPackage()
 	assert.NoError(t, err)
 	if err != nil {
 		fmt.Println(err)
@@ -905,7 +912,7 @@ func TestGitHubNewCommentContext(t *testing.T) {
 	lock := &utils.MockLock{}
 	prManager := &utils.MockPullRequestManager{ChangedFiles: []string{"dev/test.tf"}}
 	planStorage := &utils.MockPlanStorage{}
-	impactedProjects, requestedProject, prNumber, err := github.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
+	impactedProjects, requestedProject, prNumber, err := dggithub.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
 	reporter := &reporting.CiReporter{
 		CiService: prManager,
 		PrNumber:  prNumber,
@@ -914,7 +921,7 @@ func TestGitHubNewCommentContext(t *testing.T) {
 	policyChecker := &utils.MockPolicyChecker{}
 	backendApi := &utils.MockBackendApi{}
 
-	jobs, _, err := github.ConvertGithubEventToJobs(context, impactedProjects, requestedProject, map[string]configuration.Workflow{})
+	jobs, _, err := dggithub.ConvertGithubEventToJobs(context, impactedProjects, requestedProject, map[string]configuration.Workflow{})
 	_, _, err = digger.RunJobs(jobs, prManager, prManager, lock, reporter, planStorage, policyChecker, backendApi, "")
 	assert.NoError(t, err)
 	if err != nil {
@@ -923,7 +930,7 @@ func TestGitHubNewCommentContext(t *testing.T) {
 }
 
 func TestInvalidGitHubContext(t *testing.T) {
-	_, err := gh_models.GetGitHubContext(githubInvalidContextJson)
+	_, err := ghmodels.GetGitHubContext(githubInvalidContextJson)
 	require.Error(t, err)
 	if err != nil {
 		fmt.Println(err)
@@ -931,7 +938,8 @@ func TestInvalidGitHubContext(t *testing.T) {
 }
 
 func TestGitHubNewPullRequestInMultiEnvProjectContext(t *testing.T) {
-	context, err := github.GetGitHubContext(githubContextNewPullRequestJson)
+	actionContext, err := models.GetGitHubContext(githubContextNewPullRequestJson)
+	context := actionContext.ToEventPackage()
 	assert.NoError(t, err)
 	ghEvent := context.Event
 	pullRequestNumber := 11
@@ -975,9 +983,9 @@ func TestGitHubNewPullRequestInMultiEnvProjectContext(t *testing.T) {
 	// PullRequestManager Mock
 	prManager := &utils.MockPullRequestManager{ChangedFiles: []string{"dev/test.tf"}}
 	lock := &utils.MockLock{}
-	impactedProjects, requestedProject, prNumber, err := github.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
+	impactedProjects, requestedProject, prNumber, err := dggithub.ProcessGitHubEvent(ghEvent, &diggerConfig, prManager)
 	assert.NoError(t, err)
-	jobs, _, err := github.ConvertGithubEventToJobs(*context, impactedProjects, requestedProject, workflows)
+	jobs, _, err := dggithub.ConvertGithubEventToJobs(context, impactedProjects, requestedProject, workflows)
 	spew.Dump(lock.MapLock)
 	assert.Equal(t, pullRequestNumber, prNumber)
 	assert.Equal(t, 1, len(jobs))
@@ -985,8 +993,15 @@ func TestGitHubNewPullRequestInMultiEnvProjectContext(t *testing.T) {
 }
 
 func TestGitHubTestPRCommandCaseInsensitivity(t *testing.T) {
-	ghEvent := gh_models.IssueCommentEvent{}
-	ghEvent.Comment.Body = "DiGGeR PlAn"
+	issuenumber := 1
+	ghEvent := github.IssueCommentEvent{
+		Comment: &github.IssueComment{},
+		Issue: &github.Issue{
+			Number: &issuenumber,
+		},
+	}
+	comment := "DiGGeR PlAn"
+	ghEvent.Comment.Body = &comment
 
 	project := configuration.Project{Name: "test project", Workflow: "default"}
 	var impactedProjects []configuration.Project
@@ -996,7 +1011,7 @@ func TestGitHubTestPRCommandCaseInsensitivity(t *testing.T) {
 	workflows := make(map[string]configuration.Workflow, 1)
 	workflows["default"] = configuration.Workflow{}
 
-	jobs, _, err := github.ConvertGithubEventToJobs(gh_models.Github{Event: ghEvent}, impactedProjects, &requestedProject, workflows)
+	jobs, _, err := dggithub.ConvertGithubEventToJobs(dggithubmodels.EventPackage{Event: ghEvent}, impactedProjects, &requestedProject, workflows)
 
 	assert.Equal(t, 1, len(jobs))
 	assert.Equal(t, "digger plan", jobs[0].Commands[0])
diff --git a/pkg/digger/digger_test.go b/pkg/digger/digger_test.go
index 0545ab7b..32f2e1a1 100644
--- a/pkg/digger/digger_test.go
+++ b/pkg/digger/digger_test.go
@@ -1,12 +1,10 @@
 package digger
 
 import (
-	"digger/pkg/ci"
 	"digger/pkg/core/execution"
-	"digger/pkg/core/models"
 	"digger/pkg/reporting"
 	"digger/pkg/utils"
-	configuration "github.com/diggerhq/lib-digger-config"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"github.com/dominikbraun/graph"
 	"github.com/stretchr/testify/assert"
 	"sort"
@@ -116,9 +114,9 @@ func (m *MockPRManager) IsClosed(prNumber int) (bool, error) {
 	return false, nil
 }
 
-func (m *MockPRManager) GetComments(prNumber int) ([]ci.Comment, error) {
+func (m *MockPRManager) GetComments(prNumber int) ([]orchestrator.Comment, error) {
 	m.Commands = append(m.Commands, RunInfo{"GetComments", strconv.Itoa(prNumber), time.Now()})
-	return []ci.Comment{}, nil
+	return []orchestrator.Comment{}, nil
 }
 
 func (m *MockPRManager) EditComment(id interface{}, comment string) error {
@@ -216,8 +214,8 @@ func TestCorrectCommandExecutionWhenApplying(t *testing.T) {
 	}
 	planPathProvider := &MockPlanPathProvider{}
 	executor := execution.DiggerExecutor{
-		ApplyStage: &configuration.Stage{
-			Steps: []configuration.Step{
+		ApplyStage: &orchestrator.Stage{
+			Steps: []orchestrator.Step{
 				{
 					Action:    "init",
 					ExtraArgs: nil,
@@ -235,7 +233,7 @@ func TestCorrectCommandExecutionWhenApplying(t *testing.T) {
 				},
 			},
 		},
-		PlanStage:         &configuration.Stage{},
+		PlanStage:         &orchestrator.Stage{},
 		CommandRunner:     commandRunner,
 		TerraformExecutor: terraformExecutor,
 		Reporter:          reporter,
@@ -264,8 +262,8 @@ func TestCorrectCommandExecutionWhenDestroying(t *testing.T) {
 	}
 	planPathProvider := &MockPlanPathProvider{}
 	executor := execution.DiggerExecutor{
-		ApplyStage: &configuration.Stage{
-			Steps: []configuration.Step{
+		ApplyStage: &orchestrator.Stage{
+			Steps: []orchestrator.Step{
 				{
 					Action:    "init",
 					ExtraArgs: nil,
@@ -278,7 +276,7 @@ func TestCorrectCommandExecutionWhenDestroying(t *testing.T) {
 				},
 			},
 		},
-		PlanStage:         &configuration.Stage{},
+		PlanStage:         &orchestrator.Stage{},
 		CommandRunner:     commandRunner,
 		TerraformExecutor: terraformExecutor,
 		Reporter:          reporter,
@@ -305,9 +303,9 @@ func TestCorrectCommandExecutionWhenPlanning(t *testing.T) {
 	planPathProvider := &MockPlanPathProvider{}
 
 	executor := execution.DiggerExecutor{
-		ApplyStage: &configuration.Stage{},
-		PlanStage: &configuration.Stage{
-			Steps: []configuration.Step{
+		ApplyStage: &orchestrator.Stage{},
+		PlanStage: &orchestrator.Stage{
+			Steps: []orchestrator.Step{
 				{
 					Action:    "init",
 					ExtraArgs: nil,
@@ -376,7 +374,7 @@ func TestSortedCommandByDependency(t *testing.T) {
 	//	jobs []models.Job,
 	//	dependencyGraph *graph.Graph[string, string],
 
-	jobs := []models.Job{
+	jobs := []orchestrator.Job{
 		{
 			ProjectName: "project1",
 			Commands: []string{
diff --git a/pkg/integration/integration_test.go b/pkg/integration/integration_test.go
index 94e6ce07..aec252f3 100644
--- a/pkg/integration/integration_test.go
+++ b/pkg/integration/integration_test.go
@@ -5,12 +5,13 @@ import (
 	"digger/pkg/aws"
 	"digger/pkg/core/terraform"
 	"digger/pkg/digger"
-	dg_github "digger/pkg/github"
+	"digger/pkg/github/models"
 	"digger/pkg/locking"
 	"digger/pkg/reporting"
 	"digger/pkg/storage"
 	"digger/pkg/utils"
 	configuration "github.com/diggerhq/lib-digger-config"
+	dg_github "github.com/diggerhq/lib-orchestrator/github"
 	"log"
 	"math/rand"
 	"os"
@@ -370,19 +371,19 @@ func TestHappyPath(t *testing.T) {
 
 	println("--- new pull request ---")
 	newPullRequestContext := githubContextNewPullRequestMinJson
-	parsedNewPullRequestContext, err := dg_github.GetGitHubContext(newPullRequestContext)
+	parsedNewPullRequestContext, err := models.GetGitHubContext(newPullRequestContext)
 	assert.NoError(t, err)
 
 	diggerPlanCommentContext := githubContextDiggerPlanCommentMinJson
-	parsedDiggerPlanCommentContext, err := dg_github.GetGitHubContext(diggerPlanCommentContext)
+	parsedDiggerPlanCommentContext, err := models.GetGitHubContext(diggerPlanCommentContext)
 	assert.NoError(t, err)
 
 	diggerApplyCommentContext := githubContextDiggerApplyCommentMinJson
-	parsedDiggerApplyCommentContext, err := dg_github.GetGitHubContext(diggerApplyCommentContext)
+	parsedDiggerApplyCommentContext, err := models.GetGitHubContext(diggerApplyCommentContext)
 	assert.NoError(t, err)
 
 	diggerUnlockCommentContext := githubContextDiggerUnlockCommentMinJson
-	parsedDiggerUnlockCommentContext, err := dg_github.GetGitHubContext(diggerUnlockCommentContext)
+	parsedDiggerUnlockCommentContext, err := models.GetGitHubContext(diggerUnlockCommentContext)
 	assert.NoError(t, err)
 
 	ghEvent := parsedNewPullRequestContext.Event
@@ -395,7 +396,7 @@ func TestHappyPath(t *testing.T) {
 	//  new pr should lock the project
 	impactedProjects, requestedProject, prNumber, err := dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err := dg_github.ConvertGithubEventToJobs(*parsedNewPullRequestContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err := dg_github.ConvertGithubEventToJobs(parsedNewPullRequestContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	zipManager := utils.Zipper{}
 	planStorage := &storage.GithubPlanStorage{
@@ -437,7 +438,7 @@ func TestHappyPath(t *testing.T) {
 	// 'digger plan' comment should trigger terraform execution
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedNewPullRequestContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedNewPullRequestContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -450,7 +451,7 @@ func TestHappyPath(t *testing.T) {
 	// 'digger apply' comment should trigger terraform execution and unlock the project
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerApplyCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerApplyCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -473,7 +474,7 @@ func TestHappyPath(t *testing.T) {
 
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerUnlockCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerUnlockCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -525,19 +526,19 @@ func TestMultiEnvHappyPath(t *testing.T) {
 
 	println("--- new pull request ---")
 	newPullRequestContext := githubContextNewPullRequestMinJson
-	parsedNewPullRequestContext, err := dg_github.GetGitHubContext(newPullRequestContext)
+	parsedNewPullRequestContext, err := models.GetGitHubContext(newPullRequestContext)
 	assert.NoError(t, err)
 
 	diggerPlanCommentContext := githubContextDiggerPlanCommentMinJson
-	parsedDiggerPlanCommentContext, err := dg_github.GetGitHubContext(diggerPlanCommentContext)
+	parsedDiggerPlanCommentContext, err := models.GetGitHubContext(diggerPlanCommentContext)
 	assert.NoError(t, err)
 
 	diggerApplyCommentContext := githubContextDiggerApplyCommentMinJson
-	parsedDiggerApplyCommentContext, err := dg_github.GetGitHubContext(diggerApplyCommentContext)
+	parsedDiggerApplyCommentContext, err := models.GetGitHubContext(diggerApplyCommentContext)
 	assert.NoError(t, err)
 
 	diggerUnlockCommentContext := githubContextDiggerUnlockCommentMinJson
-	parsedDiggerUnlockCommentContext, err := dg_github.GetGitHubContext(diggerUnlockCommentContext)
+	parsedDiggerUnlockCommentContext, err := models.GetGitHubContext(diggerUnlockCommentContext)
 	assert.NoError(t, err)
 
 	ghEvent := parsedNewPullRequestContext.Event
@@ -551,7 +552,7 @@ func TestMultiEnvHappyPath(t *testing.T) {
 	// no files changed, no locks
 	impactedProjects, requestedProject, prNumber, err := dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err := dg_github.ConvertGithubEventToJobs(*parsedNewPullRequestContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err := dg_github.ConvertGithubEventToJobs(parsedNewPullRequestContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 
 	zipManager := utils.Zipper{}
@@ -590,7 +591,7 @@ func TestMultiEnvHappyPath(t *testing.T) {
 	// 'digger plan' comment should trigger terraform execution
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerPlanCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerPlanCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, &dynamoDbLock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -603,7 +604,7 @@ func TestMultiEnvHappyPath(t *testing.T) {
 	// 'digger apply' comment should trigger terraform execution and unlock the project
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerApplyCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerApplyCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, &dynamoDbLock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -626,7 +627,7 @@ func TestMultiEnvHappyPath(t *testing.T) {
 
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerUnlockCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerUnlockCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, &dynamoDbLock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -692,7 +693,7 @@ func TestUnLock(t *testing.T) {
 func TestNonExistentGitHubEvent(t *testing.T) {
 
 	unknownEventContext := githubContextUnknownEventJson
-	_, err := dg_github.GetGitHubContext(unknownEventContext)
+	_, err := models.GetGitHubContext(unknownEventContext)
 	println(err.Error())
 	assert.Error(t, err)
 	assert.Equal(t, "error parsing GitHub context JSON: unknown GitHub event: non_existent_event", err.Error())
@@ -742,19 +743,19 @@ workflows:
 
 	println("--- new pull request ---")
 	newPullRequestContext := githubContextNewPullRequestMinJson
-	parsedNewPullRequestContext, err := dg_github.GetGitHubContext(newPullRequestContext)
+	parsedNewPullRequestContext, err := models.GetGitHubContext(newPullRequestContext)
 	assert.NoError(t, err)
 
 	diggerPlanCommentContext := githubContextDiggerPlanCommentMinJson
-	parsedDiggerPlanCommentContext, err := dg_github.GetGitHubContext(diggerPlanCommentContext)
+	parsedDiggerPlanCommentContext, err := models.GetGitHubContext(diggerPlanCommentContext)
 	assert.NoError(t, err)
 
 	diggerApplyCommentContext := githubContextDiggerApplyCommentMinJson
-	parsedDiggerApplyCommentContext, err := dg_github.GetGitHubContext(diggerApplyCommentContext)
+	parsedDiggerApplyCommentContext, err := models.GetGitHubContext(diggerApplyCommentContext)
 	assert.NoError(t, err)
 
 	diggerUnlockCommentContext := githubContextDiggerUnlockCommentMinJson
-	parsedDiggerUnlockCommentContext, err := dg_github.GetGitHubContext(diggerUnlockCommentContext)
+	parsedDiggerUnlockCommentContext, err := models.GetGitHubContext(diggerUnlockCommentContext)
 	assert.NoError(t, err)
 
 	ghEvent := parsedNewPullRequestContext.Event
@@ -768,7 +769,7 @@ workflows:
 	//  new pr should lock the project
 	impactedProjects, requestedProject, prNumber, err := dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err := dg_github.ConvertGithubEventToJobs(*parsedNewPullRequestContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err := dg_github.ConvertGithubEventToJobs(parsedNewPullRequestContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 
 	zipManager := utils.Zipper{}
@@ -808,7 +809,7 @@ workflows:
 	// 'digger plan' comment should trigger terraform execution
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerPlanCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerPlanCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -821,7 +822,7 @@ workflows:
 	// 'digger apply' comment should trigger terraform execution and unlock the project
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerApplyCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerApplyCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
@@ -843,7 +844,7 @@ workflows:
 
 	impactedProjects, requestedProject, prNumber, err = dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
 	assert.NoError(t, err)
-	jobs, _, err = dg_github.ConvertGithubEventToJobs(*parsedDiggerUnlockCommentContext, impactedProjects, requestedProject, diggerConfig.Workflows)
+	jobs, _, err = dg_github.ConvertGithubEventToJobs(parsedDiggerUnlockCommentContext.ToEventPackage(), impactedProjects, requestedProject, diggerConfig.Workflows)
 	assert.NoError(t, err)
 	_, _, err = digger.RunJobs(jobs, &githubPrService, &githubPrService, lock, reporter, planStorage, nil, nil, dir)
 	assert.NoError(t, err)
diff --git a/pkg/reporting/reporting_test.go b/pkg/reporting/reporting_test.go
index 2d70ec80..7a35d411 100644
--- a/pkg/reporting/reporting_test.go
+++ b/pkg/reporting/reporting_test.go
@@ -1,8 +1,8 @@
 package reporting
 
 import (
-	"digger/pkg/ci"
 	"digger/pkg/core/utils"
+	orchestrator "github.com/diggerhq/lib-orchestrator"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -17,7 +17,7 @@ func TestCommentPerRunStrategyReport(t *testing.T) {
 
 	prNumber := 1
 	ciService := &MockCiService{
-		CommentsPerPr: map[int][]*ci.Comment{
+		CommentsPerPr: map[int][]*orchestrator.Comment{
 			prNumber: {
 				{
 					Id:   1,
@@ -66,7 +66,7 @@ func TestLatestCommentStrategyReport(t *testing.T) {
 
 	prNumber := 1
 	ciService := &MockCiService{
-		CommentsPerPr: map[int][]*ci.Comment{
+		CommentsPerPr: map[int][]*orchestrator.Comment{
 			prNumber: {
 				{
 					Id:   1,
@@ -112,7 +112,7 @@ func TestMultipleCommentStrategyReport(t *testing.T) {
 
 	prNumber := 1
 	ciService := &MockCiService{
-		CommentsPerPr: map[int][]*ci.Comment{
+		CommentsPerPr: map[int][]*orchestrator.Comment{
 			prNumber: {
 				{
 					Id:   1,
@@ -153,7 +153,7 @@ func TestMultipleCommentStrategyReport(t *testing.T) {
 }
 
 type MockCiService struct {
-	CommentsPerPr map[int][]*ci.Comment
+	CommentsPerPr map[int][]*orchestrator.Comment
 }
 
 func (t MockCiService) GetUserTeams(organisation string, user string) ([]string, error) {
@@ -175,7 +175,7 @@ func (t MockCiService) PublishComment(prNumber int, comment string) error {
 		}
 	}
 
-	t.CommentsPerPr[prNumber] = append(t.CommentsPerPr[prNumber], &ci.Comment{Id: latestId + 1, Body: &comment})
+	t.CommentsPerPr[prNumber] = append(t.CommentsPerPr[prNumber], &orchestrator.Comment{Id: latestId + 1, Body: &comment})
 
 	return nil
 }
@@ -208,8 +208,8 @@ func (t MockCiService) IsClosed(prNumber int) (bool, error) {
 	return false, nil
 }
 
-func (t MockCiService) GetComments(prNumber int) ([]ci.Comment, error) {
-	comments := []ci.Comment{}
+func (t MockCiService) GetComments(prNumber int) ([]orchestrator.Comment, error) {
+	comments := []orchestrator.Comment{}
 	for _, c := range t.CommentsPerPr[prNumber] {
 		comments = append(comments, *c)
 	}