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

chore: add compose module to dependabot #709

Merged
merged 2 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ updates:
interval: daily
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/compose
schedule:
interval: daily
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /e2e
schedule:
Expand Down
4 changes: 2 additions & 2 deletions examples/dependabot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func TestExamplesHasDependabotEntry(t *testing.T) {
exampleUpdates, err := getDependabotUpdates()
require.NoError(t, err)

// we have to exclude the main and e2e modules from the examples updates
assert.Equal(t, len(exampleUpdates)-2, len(examples))
// we have to exclude the main, compose and e2e modules from the examples updates
assert.Equal(t, len(exampleUpdates)-3, len(examples))

// all example modules exist in the dependabot updates
for _, example := range examples {
Expand Down
11 changes: 6 additions & 5 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ func generateDependabotUpdates(rootDir string, exampleLower string) error {

dependabotExampleUpdates := dependabotConfig.Updates

// make sure the main module is the first element in the list of examples
// and the e2e module is the second element
exampleUpdates := make(Updates, len(dependabotExampleUpdates)-2)
// make sure the main module is the first element in the list of examples,
// the compose module is the second element
// and the e2e module is the third element
exampleUpdates := make(Updates, len(dependabotExampleUpdates)-3)
j := 0

for _, exampleUpdate := range dependabotExampleUpdates {
// filter out the index.md file
if exampleUpdate.Directory != "/" && exampleUpdate.Directory != "/e2e" {
if exampleUpdate.Directory != "/" && exampleUpdate.Directory != "/modules/compose" && exampleUpdate.Directory != "/e2e" {
exampleUpdates[j] = exampleUpdate
j++
}
Expand All @@ -179,7 +180,7 @@ func generateDependabotUpdates(rootDir string, exampleLower string) error {
sort.Sort(exampleUpdates)

// prepend the main and e2e modules
exampleUpdates = append([]Update{dependabotExampleUpdates[0], dependabotExampleUpdates[1]}, exampleUpdates...)
exampleUpdates = append([]Update{dependabotExampleUpdates[0], dependabotExampleUpdates[1], dependabotExampleUpdates[2]}, exampleUpdates...)

dependabotConfig.Updates = exampleUpdates

Expand Down
6 changes: 4 additions & 2 deletions examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ func assertDependabotExamplesUpdates(t *testing.T, example Example, originalConf

// first item is the main module
assert.Equal(t, "/", examples[0].Directory, examples)
// second item is the e2e module
assert.Equal(t, "/e2e", examples[1].Directory, examples)
// second item is the compose module
assert.Equal(t, "/modules/compose", examples[1].Directory, examples)
// third item is the e2e module
assert.Equal(t, "/e2e", examples[2].Directory, examples)
}

// assert content example file in the docs
Expand Down