diff --git a/pkg/config/config.go b/pkg/config/config.go index 3a9fc9e..eab1685 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -110,7 +110,7 @@ func InitConfiguration() []cli.Flag { Name: "export_fields", EnvVars: []string{"EXPORT_FIELDS"}, Usage: "A comma separated list of fields for workflow metrics that should be exported", - Value: "repo,id,node_id,head_branch,head_sha,run_number,workflow_id,workflow,event,status", + Value: "repo,id,node_id,head_branch,head_sha,run_number,workflow_id,workflow,event,status,actor", Destination: &WorkflowFields, }, &cli.BoolFlag{ diff --git a/pkg/metrics/get_workflow_runs_from_github.go b/pkg/metrics/get_workflow_runs_from_github.go index 4e376f1..1ceba4f 100644 --- a/pkg/metrics/get_workflow_runs_from_github.go +++ b/pkg/metrics/get_workflow_runs_from_github.go @@ -29,6 +29,8 @@ func getFieldValue(repo string, run github.WorkflowRun, field string) string { return strconv.Itoa(*run.RunNumber) case "workflow_id": return strconv.FormatInt(*run.WorkflowID, 10) + case "actor": + return getActorLogin(&run) case "workflow": r, exist := workflows[repo] if !exist { @@ -50,6 +52,10 @@ func getFieldValue(repo string, run github.WorkflowRun, field string) string { return "" } +func getActorLogin(run *github.WorkflowRun) string { + return run.Actor.GetLogin() +} + func getRelevantFields(repo string, run *github.WorkflowRun) []string { relevantFields := strings.Split(config.WorkflowFields, ",") result := make([]string, len(relevantFields))