Skip to content

Commit

Permalink
interval
Browse files Browse the repository at this point in the history
  • Loading branch information
juliojimenez committed Jun 2, 2021
1 parent f058d4d commit 8608653
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 61 deletions.
10 changes: 8 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
65 changes: 11 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
```
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
version = "0.0.9"
version = "0.0.11"
verbose bool
trace bool
debug bool
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
23 changes: 22 additions & 1 deletion lib/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit 8608653

Please sign in to comment.