mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-27 00:23:41 +09:00
The event reported a completion status instead of requested, therefore sent an email Backport #35689
This commit is contained in:
@@ -425,7 +425,8 @@ func Rerun(ctx *context_module.Context) {
|
|||||||
run.PreviousDuration = run.Duration()
|
run.PreviousDuration = run.Duration()
|
||||||
run.Started = 0
|
run.Started = 0
|
||||||
run.Stopped = 0
|
run.Stopped = 0
|
||||||
if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "previous_duration"); err != nil {
|
run.Status = actions_model.StatusWaiting
|
||||||
|
if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "status", "previous_duration"); err != nil {
|
||||||
ctx.ServerError("UpdateRun", err)
|
ctx.ServerError("UpdateRun", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1418,7 +1418,7 @@ jobs:
|
|||||||
assert.Equal(t, "user2/repo1", webhookData.payloads[1].Repo.FullName)
|
assert.Equal(t, "user2/repo1", webhookData.payloads[1].Repo.FullName)
|
||||||
|
|
||||||
// Call rerun ui api
|
// Call rerun ui api
|
||||||
// Only a web UI API exists for cancelling workflow runs, so use the UI endpoint.
|
// Only a web UI API exists for rerunning workflow runs, so use the UI endpoint.
|
||||||
rerunURL := fmt.Sprintf("/user2/repo1/actions/runs/%d/rerun", webhookData.payloads[0].WorkflowRun.RunNumber)
|
rerunURL := fmt.Sprintf("/user2/repo1/actions/runs/%d/rerun", webhookData.payloads[0].WorkflowRun.RunNumber)
|
||||||
req = NewRequestWithValues(t, "POST", rerunURL, map[string]string{
|
req = NewRequestWithValues(t, "POST", rerunURL, map[string]string{
|
||||||
"_csrf": GetUserCSRFToken(t, session),
|
"_csrf": GetUserCSRFToken(t, session),
|
||||||
@@ -1426,6 +1426,15 @@ jobs:
|
|||||||
session.MakeRequest(t, req, http.StatusOK)
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
assert.Len(t, webhookData.payloads, 3)
|
assert.Len(t, webhookData.payloads, 3)
|
||||||
|
|
||||||
|
// 5. Validate the third webhook payload
|
||||||
|
assert.Equal(t, "workflow_run", webhookData.triggeredEvent)
|
||||||
|
assert.Equal(t, "requested", webhookData.payloads[2].Action)
|
||||||
|
assert.Equal(t, "queued", webhookData.payloads[2].WorkflowRun.Status)
|
||||||
|
assert.Equal(t, repo1.DefaultBranch, webhookData.payloads[2].WorkflowRun.HeadBranch)
|
||||||
|
assert.Equal(t, commitID, webhookData.payloads[2].WorkflowRun.HeadSha)
|
||||||
|
assert.Equal(t, "repo1", webhookData.payloads[2].Repo.Name)
|
||||||
|
assert.Equal(t, "user2/repo1", webhookData.payloads[2].Repo.FullName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testWorkflowRunEventsOnCancellingAbandonedRun(t *testing.T, webhookData *workflowRunWebhook, allJobsAbandoned bool) {
|
func testWorkflowRunEventsOnCancellingAbandonedRun(t *testing.T, webhookData *workflowRunWebhook, allJobsAbandoned bool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user