Skip to content

Commit af836b7

Browse files
authored
Use config constants in TUI (#240)
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
1 parent c0830ce commit af836b7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sourcetool/internal/cmd/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ repositories. Make sure you have a fork of the SLSA source policy repo and
247247
a fork of the repository you want to protect.
248248
249249
`, w("sourcetool setup controls"), w2("configure a repository for SLSA source"),
250-
w2("CONFIG_BRANCH_RULES"), w2("CONFIG_PROVENANCE_WORKFLOW"), w2("CONFIG_POLICY")),
250+
w2(models.CONFIG_BRANCH_RULES), w2(models.CONFIG_GEN_PROVENANCE), w2(models.CONFIG_POLICY)),
251251
Use: "controls owner/repo --config=CONTROL1 --config=CONTROL2",
252252
SilenceUsage: false,
253253
SilenceErrors: true,

sourcetool/pkg/sourcetool/backends/vcs/github/github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (b *Backend) getRecommendedAction(r *models.Repository, _ *models.Branch, c
224224
case slsa.StateNotEnabled:
225225
return &slsa.ControlRecommendedAction{
226226
Message: "Start generating provenance",
227-
Command: fmt.Sprintf("sourcetool setup controls --config=CONFIG_PROVENANCE_WORKFLOW %s", r.Path),
227+
Command: fmt.Sprintf("sourcetool setup controls --config=%s %s", models.CONFIG_GEN_PROVENANCE, r.Path),
228228
}
229229
default:
230230
return nil
@@ -233,7 +233,7 @@ func (b *Backend) getRecommendedAction(r *models.Repository, _ *models.Branch, c
233233
if state == slsa.StateNotEnabled {
234234
return &slsa.ControlRecommendedAction{
235235
Message: "Enable branch push/delete protection",
236-
Command: fmt.Sprintf("sourcetool setup controls --config=CONFIG_BRANCH_RULES %s", r.Path),
236+
Command: fmt.Sprintf("sourcetool setup controls --config=%s %s", models.CONFIG_BRANCH_RULES, r.Path),
237237
}
238238
}
239239
return nil

sourcetool/pkg/sourcetool/backends/vcs/github/manage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (b *Backend) CreateRepoRuleset(r *models.Repository, branches []*models.Bra
158158
return errors.New("unable to create repo ruleset, branch not set")
159159
}
160160

161-
if len(branches) > 0 {
161+
if len(branches) > 1 {
162162
return errors.New("protecting more than one branch at a time is not yet supported")
163163
}
164164

0 commit comments

Comments
 (0)