Skip to content

Commit 9b3eb4c

Browse files
committed
change action of workflow_run to align
1 parent 4629a68 commit 9b3eb4c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

services/actions/notifier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep
774774
org = convert.ToOrganization(ctx, organization.OrgFromUser(repo.Owner))
775775
}
776776

777-
status, _ := convert.ToActionsStatus(run.Status)
777+
status := convert.ToWorkflowRunAction(run.Status)
778778

779779
gitRepo, err := gitrepo.OpenRepository(context.Background(), repo)
780780
if err != nil {

services/convert/convert.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,20 @@ func ToActionWorkflowRun(ctx context.Context, repo *repo_model.Repository, run *
258258
}, nil
259259
}
260260

261+
func ToWorkflowRunAction(status actions_model.Status) string {
262+
var action string
263+
switch status {
264+
case actions_model.StatusWaiting, actions_model.StatusBlocked:
265+
action = "requested"
266+
case actions_model.StatusRunning:
267+
action = "in_progress"
268+
}
269+
if status.IsDone() {
270+
action = "completed"
271+
}
272+
return action
273+
}
274+
261275
func ToActionsStatus(status actions_model.Status) (string, string) {
262276
var action string
263277
var conclusion string

services/webhook/notifier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_
985985
org = convert.ToOrganization(ctx, organization.OrgFromUser(repo.Owner))
986986
}
987987

988-
status, _ := convert.ToActionsStatus(run.Status)
988+
status := convert.ToWorkflowRunAction(run.Status)
989989

990990
gitRepo, err := gitrepo.OpenRepository(ctx, repo)
991991
if err != nil {

0 commit comments

Comments
 (0)