mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Add a doctor command to fix inconsistent run status (#35840)
#35783 fixes an actions rerun bug. Due to this bug, some runs may be incorrectly marked as `StatusWaiting` even though all the jobs are in done status. These runs cannot be run or cancelled. This PR adds a new doctor command to fix the inconsistent run status. ``` gitea doctor check --run fix-actions-unfinished-run-status --fix ``` Thanks to @ChristopherHX for the test.
This commit is contained in:
24
services/doctor/actions_test.go
Normal file
24
services/doctor/actions_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package doctor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
actions_model "code.gitea.io/gitea/models/actions"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_fixUnfinishedRunStatus(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
fixUnfinishedRunStatus(t.Context(), log.GetLogger(log.DEFAULT), true)
|
||||
|
||||
// check if the run is cancelled by id
|
||||
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{ID: 805})
|
||||
assert.Equal(t, actions_model.StatusCancelled, run.Status)
|
||||
}
|
||||
Reference in New Issue
Block a user