mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
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:
4 files changed
+32
No files matched your search
@@ -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"}},
|
||||
|
||||
@@ -52,6 +52,7 @@ func TestClassifyRequestNamesTheResource(t *testing.T) {
|
||||
{"repository exists", "POST", "/api/v1/user/repos", "The repository with the same name already exists.", 409, "repository already exists"},
|
||||
{"org repository exists", "POST", "/api/v1/orgs/acme/repos", "The repository with the same name already exists.", 409, "repository already exists"},
|
||||
{"run completed", "POST", "/api/v1/repos/alice/x/actions/runs/35/cancel", "run is already completed", 409, "run 35 is already completed"},
|
||||
{"run not done", "DELETE", "/api/v1/repos/alice/x/actions/runs/37", "this workflow run is not done", 400, "run 37 has not finished"},
|
||||
{"workflow disabled", "POST", "/api/v1/repos/alice/x/actions/workflows/nightly.yaml/dispatches", "workflow is disabled", 403, "workflow nightly.yaml is disabled"},
|
||||
{"key in use", "POST", "/api/v1/user/keys", "Key content has been used as non-deploy key", 422, "this SSH key is already registered"},
|
||||
{"unknown assignee", "POST", "/api/v1/repos/alice/x/issues", "Assignee does not exist: [name: user does not exist [uid: 0, name: nobody123]]", 422, `user "nobody123" not found`},
|
||||
|
||||
Reference in new issue
Block a user