Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CircleCI] Add configurable number of builds to settings #1025

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/circleci/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ const (
type Settings struct {
common *cfg.Common

apiKey string `help:"Your CircleCI API token."`
apiKey string `help:"Your CircleCI API token."`
buildNumber int `help:"The number of build, 10 by default"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest numberOfBuilds instead. buildNumber could be misconstrued as a specific build number (ie. 453) rather than a quantity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Adressed this in 5b17ddf, thanks for the review.
Not sure why the linting fails in https://github.com/wtfutil/wtf/pull/1025/checks?check_run_id=1421195730 though.

}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {

settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),

apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_CIRCLE_API_KEY"))),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_CIRCLE_API_KEY"))),
buildNumber: ymlConfig.UInt("buildNumber", 10),
}

cfg.ModuleSecret(name, globalConfig, &settings.apiKey).Load()
Expand Down
2 changes: 1 addition & 1 deletion modules/circleci/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (widget *Widget) content() (string, string, bool) {
str = err.Error()
} else {
for idx, build := range builds {
if idx > 10 {
if idx > widget.settings.buildNumber {
break
}

Expand Down