Skip to content

Commit

Permalink
fix: allow environment to be accepted as input to workflow (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 authored Jan 9, 2024
1 parent 274cc43 commit fb9ad40
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cd/manager/jobs/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ func GitHubWorkflowJob(jobState job.JobState, db manager.Database, notifs manage
} else {
// Add the job ID to the inputs, so we can track the right workflow corresponding to this job.
workflow.Inputs[job.WorkflowJobParam_JobId] = jobState.JobId
// Set the environment so that the workflow knows which environment to target

env := os.Getenv(manager.EnvVar_Env)
workflow.Inputs[job.WorkflowJobParam_Environment] = env
// If a target environment has not been specified, use the current environment.
if inputEnv, found := workflow.Inputs[job.WorkflowJobParam_Environment].(string); found {
workflow.Inputs[job.WorkflowJobParam_Environment] = inputEnv
} else {
workflow.Inputs[job.WorkflowJobParam_Environment] = env
}

var httpClient *http.Client = nil
if accessToken, found := os.LookupEnv("GITHUB_ACCESS_TOKEN"); found {
Expand Down

0 comments on commit fb9ad40

Please sign in to comment.