mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-27 18:15:18 +02:00
fix(actions): fix 500 error when canceling a canceling task (#38223)
This commit is contained in:
@@ -177,3 +177,13 @@ func TestToActionWorkflowJob_StepStatusIsIndependentOfJobStatus(t *testing.T) {
|
||||
assert.Equal(t, "completed", apiJob.Steps[1].Status, "step 1 status")
|
||||
assert.Equal(t, "failure", apiJob.Steps[1].Conclusion, "step 1 conclusion")
|
||||
}
|
||||
|
||||
func TestToActionsStatus_Cancelling(t *testing.T) {
|
||||
action, conclusion := ToActionsStatus(actions_model.StatusCancelling)
|
||||
assert.Equal(t, "in_progress", action)
|
||||
assert.Empty(t, conclusion)
|
||||
}
|
||||
|
||||
func TestToWorkflowRunAction_Cancelling(t *testing.T) {
|
||||
assert.Equal(t, "in_progress", ToWorkflowRunAction(actions_model.StatusCancelling))
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ func ToWorkflowRunAction(status actions_model.Status) (action string) {
|
||||
switch status {
|
||||
case actions_model.StatusWaiting, actions_model.StatusBlocked:
|
||||
action = "requested"
|
||||
case actions_model.StatusRunning:
|
||||
case actions_model.StatusRunning, actions_model.StatusCancelling:
|
||||
action = "in_progress"
|
||||
default:
|
||||
if status.IsDone() {
|
||||
@@ -430,7 +430,7 @@ func ToActionsStatus(status actions_model.Status) (action, conclusion string) {
|
||||
action = "queued" // "waiting" is a naming conflict of the webhook between Gitea and GitHub Actions
|
||||
case actions_model.StatusBlocked:
|
||||
action = "waiting" // naming conflict (as above)
|
||||
case actions_model.StatusRunning:
|
||||
case actions_model.StatusRunning, actions_model.StatusCancelling:
|
||||
action = "in_progress"
|
||||
default:
|
||||
action = "completed"
|
||||
|
||||
Reference in New Issue
Block a user