Skip to content

Conversation

@marians
Copy link
Member

@marians marians commented Oct 21, 2025

Towards https://github.com/giantswarm/giantswarm/issues/28741, https://github.com/giantswarm/giantswarm/issues/34621

This PR changes the devctl repo setup command so that if the --renovate flag is set true (by default), a ruleset is created to allow Renovate to merge approved PRs.

The ruleset is named renovate-automerge.

If the ruleset with that name already exists in the repo, it is checked for up-to-dateness. If not up-to-date, it is recreated.

This PR also removes the flag --dry-run from the same command, as it had absolutely no function in this command.

Testing

go run main.go repo setup giantswarm/repo-slug

Preview

When the ruleset was not yet in place:

$ go run main.go repo setup giantswarm/renovate-playground
INFO[0000] get repository details for "giantswarm/renovate-playground"
INFO[0000] configure repository settings
INFO[0000] grant permission on repository
INFO[0001] configure protection for "main" branch
INFO[0002] Adding giantswarm/renovate-playground to repositories accessible by Renovate...
INFO[0003] response status: "204 No Content"
INFO[0003] reading ruleset renovate-automerge from repository giantswarm/renovate-playground
INFO[0003] Ruleset for renovate not found in repository giantswarm/renovate-playground, creating it...
INFO[0003] Creating ruleset for renovate in repository giantswarm/renovate-playground
INFO[0003] creating ruleset renovate-automerge in repository giantswarm/renovate-playground
INFO[0003] completed repository setup

When the ruleset existed but was modified:

$ go run main.go repo setup giantswarm/renovate-playground
INFO[0000] get repository details for "giantswarm/renovate-playground"
INFO[0000] configure repository settings
INFO[0000] grant permission on repository
INFO[0001] configure protection for "main" branch
INFO[0002] Adding giantswarm/renovate-playground to repositories accessible by Renovate...
INFO[0003] response status: "204 No Content"
INFO[0003] reading ruleset renovate-automerge from repository giantswarm/renovate-playground
INFO[0003] Ruleset renovate-automerge (ID 9052178) already exists in repository giantswarm/renovate-playground
INFO[0003] Found these differences in ruleset:
  github.RepositoryRuleset{
  	... // 9 identical fields
  	Links:      nil,
  	Conditions: &{RefName: &{Include: {"~DEFAULT_BRANCH"}, Exclude: {}}},
  	Rules: &github.RepositoryRulesetRules{
- 		Creation: nil,
+ 		Creation: &github.EmptyRuleParameters{},
  		Update:   nil,
  		Deletion: nil,
  		... // 18 identical fields
  	},
  	UpdatedAt: nil,
  	CreatedAt: nil,
  }

INFO[0003] Ruleset renovate-automerge (ID 9052178) is not up-to-date in repository giantswarm/renovate-playground
INFO[0003] Deleting ruleset renovate-automerge (ID 9052178) in repository giantswarm/renovate-playground
INFO[0004] Creating ruleset for renovate in repository giantswarm/renovate-playground
INFO[0004] creating ruleset renovate-automerge in repository giantswarm/renovate-playground
INFO[0004] completed repository setup

When the ruleset existed as desired:

$ go run main.go repo setup giantswarm/renovate-playground
INFO[0000] get repository details for "giantswarm/renovate-playground"
INFO[0000] configure repository settings
INFO[0000] grant permission on repository
INFO[0001] configure protection for "main" branch
INFO[0002] Adding giantswarm/renovate-playground to repositories accessible by Renovate...
INFO[0002] response status: "204 No Content"
INFO[0002] reading ruleset renovate-automerge from repository giantswarm/renovate-playground
INFO[0003] Ruleset renovate-automerge (ID 9052072) already exists in repository giantswarm/renovate-playground
INFO[0003] Ruleset renovate-automerge (ID 9052072) is up-to-date in repository giantswarm/renovate-playground
INFO[0003] completed repository setup

Checklist

  • Update changelog in CHANGELOG.md.

@marians marians self-assigned this Oct 21, 2025
@marians marians requested a review from a team as a code owner October 21, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants