diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f0a19a2..93d3dad 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,8 +3,14 @@ updates: - package-ecosystem: github-actions directory: /.github/workflows schedule: - interval: daily + interval: weekly + day: tuesday + time: "12:00" + timezone: America/New_York - package-ecosystem: gomod directory: / schedule: - interval: daily + interval: weekly + day: tuesday + time: "12:00" + timezone: America/New_York diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 493db8b..45055c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: release_name: Release ${{ github.ref }} body: | This release has the following changes: - - Truncate updates if greater than 200. + - Interval Options. draft: false prerelease: false diff --git a/README.md b/README.md index 5b22b0e..b1236b2 100644 --- a/README.md +++ b/README.md @@ -25,51 +25,12 @@ sudo chmod +x hinge-1.0.0-linux-amd64 sudo mv hinge-1.0.0-linux-amd64 /usr/local/bin/hinge ``` -## How To Hinge :dancer: +## Usage -### hinge - -Running `hinge` with no arguments will produce the following output. - -```bash -$ hinge -Hinge -https://github.com/devops-kung-fu/hinge -Version: 1.0.0 - -Please provide the path to the repository. - -Usage: - hinge [flags] path/to/repo - -Examples: - hinge path/to/repo - -Flags: - -h, --help help for hinge - -v, --version version for hinge -``` - -### hinge /path/to/repository - -Running `hinge` with the path to the root of the repository will write the configuration to `.github/dependabot.yml`. - -```bash -$ hinge . -Hinge -https://github.com/devops-kung-fu/hinge -Version: 1.0.0 ``` - -In the above example we are at the root of the repository. - -### hinge -h|--help - -```bash -$ hinge -h Hinge https://github.com/devops-kung-fu/hinge -Version: 1.0.0 +Version: 0.0.9 Creates and updates your Dependabot config. @@ -80,17 +41,13 @@ Examples: hinge path/to/repo Flags: - -h, --help help for hinge - -v, --version version for hinge -``` - -### hinge -v|--version - -```bash -$ hinge -v -Hinge -https://github.com/devops-kung-fu/hinge -Version: 1.0.0 - -hinge version 1.0.0 + -d, --day string Specify a day to check for updates. (default "daily") + --debug Displays debug level log messages. + -h, --help help for hinge + -i, --interval string How often to check for new versions. (default "daily") + -t, --time string Specify a time of day to check for updates (format: hh:mm). (default "05:00") + -z, --timezone string Specify a time zone. The time zone identifier must be from the Time Zone database maintained by IANA. (default "UTC") + --trace Displays trace level log messages. + -v, --verbose Displays dependabot.yml configuration in stardard output. + --version version for hinge ``` \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 791d4f7..9f1000f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,7 +11,7 @@ import ( ) var ( - version = "0.0.9" + version = "0.0.11" verbose bool trace bool debug bool @@ -32,7 +32,7 @@ var ( case debug: heyBo.ChangeGlobalLevel(heybo.TRACE) } - heyBo.ChangeTagText(heybo.INFO, "pass") + heyBo.ChangeTagText(heybo.INFO, "PASS") if len(args) == 0 { color.Style{color.FgRed, color.OpBold}.Println("Please provide the path to the repository.") fmt.Println() diff --git a/lib/generate.go b/lib/generate.go index ec46a7b..f61889a 100644 --- a/lib/generate.go +++ b/lib/generate.go @@ -74,7 +74,7 @@ func directoryParser(fs afero.Fs, regex string, repoPath string) []string { cleanFile := strings.Replace(file, repoPath, "", 1) cleanDiscovery = append(cleanDiscovery, cleanFile) } else if strings.HasPrefix(file, ".github") { - cleanDiscovery = append(cleanDiscovery, "/"+file) + cleanDiscovery = append(cleanDiscovery, "/" + file) } else { cleanDiscovery = append(cleanDiscovery, file) } diff --git a/lib/generate_test.go b/lib/generate_test.go index ad0d2e6..e48954c 100644 --- a/lib/generate_test.go +++ b/lib/generate_test.go @@ -2,10 +2,31 @@ package lib import ( "reflect" - "testing" + + "github.com/spf13/afero" ) +func TestDirectoryParserGitHub(t *testing.T) { + fs := afero.NewMemMapFs() + _ = fs.Mkdir(".github", 0755) + _ = fs.Mkdir(".github/workflows", 0755) + _, _ = fs.Create(".github/workflows/ci.yml") + results := directoryParser(fs, `(.*)\.yml`, ".") + if results[0] != "/.github/workflows" { + t.Error() + } +} + +func TestDirectoryParserGoMod(t *testing.T) { + fs := afero.NewMemMapFs() + _, _ = fs.Create("go.mod") + results := directoryParser(fs, `go\.mod`, ".") + if results[0] != "/" { + t.Error() + } +} + func TestRemoveDuplicates(t *testing.T) { sliceWithDupes := []string{"1", "1", "2", "2", "3", "3"} correctSlice := []string{"1", "2", "3"}