Skip to content

Commit a89763e

Browse files
committed
..
1 parent 9721f6a commit a89763e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

acceptance/main.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@ type acceptance struct {
4646
*boilerplate.Boilerplate
4747
}
4848

49+
func (a *acceptance) canCreateIssues() bool {
50+
createIssues := strings.ToLower(a.Action.GetInput("create_issues"))
51+
return createIssues == "true" || createIssues == "yes"
52+
}
53+
4954
func (a *acceptance) syncTodos(ctx context.Context) error {
55+
if !a.canCreateIssues() {
56+
return nil
57+
}
5058
directory, _, err := a.getProject()
5159
if err != nil {
5260
return fmt.Errorf("project: %w", err)
@@ -63,6 +71,10 @@ func (a *acceptance) syncTodos(ctx context.Context) error {
6371
}
6472

6573
func (a *acceptance) trigger(ctx context.Context) (*notify.Notification, error) {
74+
err := a.syncTodos(ctx)
75+
if err != nil {
76+
return nil, fmt.Errorf("sync todos: %w", err)
77+
}
6678
vaultURI := a.Action.GetInput("vault_uri")
6779
directory, project, err := a.getProject()
6880
if err != nil {
@@ -146,9 +158,8 @@ func (a *acceptance) runWithTimeout(
146158

147159
func (a *acceptance) notifyIfNeeded(ctx context.Context, alert *notify.Notification) error {
148160
slackWebhook := a.Action.GetInput("slack_webhook")
149-
createIssues := strings.ToLower(a.Action.GetInput("create_issues"))
150161
needsSlack := slackWebhook != ""
151-
needsIssues := createIssues == "true" || createIssues == "yes"
162+
needsIssues := a.canCreateIssues()
152163
needsNotification := needsSlack || needsIssues
153164
if !alert.Report.Pass() && needsNotification {
154165
if needsSlack {
@@ -159,12 +170,6 @@ func (a *acceptance) notifyIfNeeded(ctx context.Context, alert *notify.Notificat
159170
}
160171
}
161172
if needsIssues {
162-
// doesn't seem to pick the right commit hash, so it's better to do it nightly
163-
// see https://github.com/databrickslabs/ucx/issues/3195
164-
err := a.syncTodos(ctx)
165-
if err != nil {
166-
return fmt.Errorf("sync todos: %w", err)
167-
}
168173
for _, v := range alert.Report {
169174
if !v.Failed() {
170175
continue

0 commit comments

Comments
 (0)