fix error handling and revert changes to test files

This commit is contained in:
badhezi 2025-04-30 09:55:06 +03:00
parent 53d9753f9d
commit 318bf1c484
2 changed files with 60 additions and 88 deletions

View File

@ -318,9 +318,6 @@ func handleWorkflows(
if runName, err := parseRunName(run, dwf); err == nil {
run.Title = runName
} else {
log.Error("evaluateExpressionsForRun: %v", err)
continue
}
need, err := ifNeedApproval(ctx, run, input.Repo, input.Doer)
@ -532,8 +529,6 @@ func handleSchedules(
if runName, err := parseRunName(run.ToActionRun(), dwf); err == nil {
run.Title = runName
} else {
log.Error("ParseRunName: %v", err)
}
crons = append(crons, run)
@ -591,7 +586,11 @@ func parseRunName(r *actions_model.ActionRun, w *actions_module.DetectedWorkflow
return "", err
}
title, _ := jobparser.ParseRunName(w.Content, jobparser.WithGitContext(ghCtx))
log.Info("title: %s", title)
title, err := jobparser.ParseRunName(w.Content, jobparser.WithGitContext(ghCtx))
if err != nil {
// stay silent, run-name was not provided.
return "", err
}
return title, nil
}

View File

@ -416,13 +416,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "create",
Ref: "refs/heads/test-create-branch",
WorkflowID: "createdelete.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
@ -432,13 +429,10 @@ jobs:
run = unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "create",
Ref: "refs/tags/test-create-tag",
WorkflowID: "createdelete.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
@ -448,13 +442,10 @@ jobs:
run = unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "delete",
Ref: "refs/heads/main",
WorkflowID: "createdelete.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
@ -466,13 +457,10 @@ jobs:
run = unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "delete",
Ref: "refs/heads/main",
WorkflowID: "createdelete.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
})
@ -776,13 +764,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "workflow_dispatch",
Ref: "refs/heads/main",
WorkflowID: "dispatch.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
})
@ -861,13 +846,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "workflow_dispatch",
Ref: "refs/heads/main",
WorkflowID: "dispatch.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
dispatchPayload := &api.WorkflowDispatchPayload{}
@ -959,13 +941,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "workflow_dispatch",
Ref: "refs/heads/main",
WorkflowID: "dispatch.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
})
@ -1047,13 +1026,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "workflow_dispatch",
Ref: "refs/heads/main",
WorkflowID: "dispatch.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
dispatchPayload := &api.WorkflowDispatchPayload{}
@ -1378,13 +1354,10 @@ jobs:
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
Title: "add workflow",
RepoID: repo.ID,
Repo: repo,
Event: "workflow_dispatch",
Ref: "refs/heads/main",
WorkflowID: "dispatch.yml",
CommitSHA: branch.CommitID,
TriggerUserID: user2.ID,
TriggerUser: user2,
})
assert.NotNil(t, run)
dispatchPayload := &api.WorkflowDispatchPayload{}