Skip to content

Commit

Permalink
Merge pull request #49 from flaticols/fix/rename-do-to-create
Browse files Browse the repository at this point in the history
Rename `do` to `create`
  • Loading branch information
flaticols authored Dec 15, 2022
2 parents d772863 + 6cb021e commit 77aadef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ COPY --from=builder --chown=65534:0 /bin/tagger /tagger

USER nobody
ENTRYPOINT ["/tagger"]
CMD ["do", "--actions"]
CMD ["create", "--actions"]
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Tagger 0.7
# Tagger 0.8

Creating a new release using the labels from the Pull Requests

Expand All @@ -16,10 +16,10 @@ Add a one of `major`, `minor` or `path` label to your PR and merge it.

##### Add `patch` and I have latest tag `v0.4.10`
Result: release with tag and name `v0.4.11`

##### Add `Minor` and I have latest tag `v0.4.10`
Result: release with tag and name `v0.5.0`

##### Add `Major` and I have latest tag `v0.4.10`
Result: release with tag and name `v1.0.0`

Expand Down Expand Up @@ -89,5 +89,25 @@ jobs:
### Run locally
```bash
go run . do -o flaticols -r tagger -t $(gh auth token)
```
go run . create -o flaticols -r tagger -t $(gh auth token)
```

### Use as package

```go
package main

import C "github.com/flaticols/tagger/commands"

func main() {
root := cobra.Command{}

root.AddCommand(C.CreateCommand())

_, err := root.ExecuteC()
if err != nil {
return
}
}

```
6 changes: 2 additions & 4 deletions commands/do.go → commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/spf13/pflag"
)

func DoCommand() *cobra.Command {
func CreateCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "do",
Use: "create",
Short: "Create a release",
PreRun: func(cmd *cobra.Command, args []string) {
isActions, _ := cmd.Flags().GetBool("actions")
Expand All @@ -27,8 +27,6 @@ func DoCommand() *cobra.Command {

params := inputs.Inputs{}

fmt.Printf("GitHub Actions Params: %+v", params)

major, _ := flags.GetBool("major")
minor, _ := flags.GetBool("minor")
patch, _ := flags.GetBool("patch")
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func main() {
root := cobra.Command{}

root.AddCommand(commands.DoCommand())
root.AddCommand(commands.CreateCommand())

_, err := root.ExecuteC()
if err != nil {
Expand Down

0 comments on commit 77aadef

Please sign in to comment.