Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow environment to be accepted as input to workflow #56

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading