feat: explain refusals to delete or rerun an unfinished run

Gitea refuses to delete or rerun a run that has not finished with "this
workflow run is not done". Report "run 37 has not finished; cancel it first:
tea run cancel 37", and cover the next steps added to refusals in tests.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 22:48:50 +02:00
1 parent 6fe72cdfd1
commit dc43272085
4 files changed
+32

No files matched your search

+4
View File
@@ -58,6 +58,7 @@ const (
ReasonNoChanges = "no changes" // the head branch has no commits the base lacks
ReasonDisabled = "disabled" // the workflow is disabled
ReasonCompleted = "completed" // the run already finished
ReasonNotDone = "not done" // the run has not finished yet
ReasonKeyInUse = "key in use" // the SSH key is registered already
ReasonOwnsRepos = "owns repositories" // the user still owns repositories
)
@@ -98,6 +99,8 @@ func (e *ConflictError) Error() string {
text = cmp.Or(subject, "the workflow") + " is disabled"
case ReasonCompleted:
text = cmp.Or(subject, "the run") + " is already completed"
case ReasonNotDone:
text = cmp.Or(subject, "the run") + " has not finished"
case ReasonKeyInUse:
text = "this SSH key is already registered"
case ReasonOwnsRepos:
@@ -145,6 +148,7 @@ var refusals = []struct {
{ReasonNoChanges, nil, []string{"no changes between the head and the base"}},
{ReasonDisabled, nil, []string{"workflow is disabled"}},
{ReasonCompleted, nil, []string{"already completed"}},
{ReasonNotDone, []int{http.StatusBadRequest}, []string{"not done"}},
{ReasonKeyInUse, nil, []string{"key content has been used"}},
{ReasonOwnsRepos, nil, []string{"ownership of repositories"}},
{ReasonExists, []int{http.StatusBadRequest, http.StatusConflict, http.StatusUnprocessableEntity}, []string{"already exist", "release is has no tag"}},