Skip to content

Commit

Permalink
Merge pull request #29 from nekonenene/develop
Browse files Browse the repository at this point in the history
Release 2022-12-10 13:13
  • Loading branch information
nekonenene authored Dec 10, 2022
2 parents 916d76a + 9272846 commit 31ca96a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,10 @@ It fetches pull requests which merged into the development branch, and generates

## Installation

Go 1.17+:

```sh
go install github.com/nekonenene/gh-release-pr-generator@v1
```

Otherwise:

```sh
go get github.com/nekonenene/gh-release-pr-generator@v1
```


## Usage

Expand Down
5 changes: 5 additions & 0 deletions cmd/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func Exec() {
fmt.Println(pullRequestBody)
fmt.Println()

if params.DryRun {
fmt.Println("[Dry Run] Exit here without creating or updating a pull request.")
return
}

releasePullRequest, isCreated, err := CreateOrUpdatePullRequest(pullRequestTitle, pullRequestBody)
if err != nil {
log.Fatal(err)
Expand Down
12 changes: 12 additions & 0 deletions cmd/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package cmd

import (
"flag"
"fmt"
"log"
"os"
)

type parameters struct {
Expand All @@ -14,9 +16,12 @@ type parameters struct {
TemplatePath string
FetchPullRequestsLimit int
EnterpriseURL string
DryRun bool
ShowVersion bool
}

var params parameters
var Version = "v1.7.0"

func ParseParameters() {
flag.StringVar(&params.GitHubAPIToken, "token", "", "[Required] GitHub API Token")
Expand All @@ -29,8 +34,15 @@ func ParseParameters() {
flag.StringVar(&params.TemplatePath, "template-path", "", "[Opiton] template path for customizing the title and the body of the release pull request")
flag.IntVar(&params.FetchPullRequestsLimit, "limit", FetchPullRequestsLimitDefault, "[Opiton] limit number of fetching pull requests")
flag.StringVar(&params.EnterpriseURL, "enterprise-url", "", "[Opiton] URL of GitHub Enterprise (ex. https://github.your.domain )")
flag.BoolVar(&params.DryRun, "dry-run", false, "[Opiton] Only display, not create or update a pull request")
flag.BoolVar(&params.ShowVersion, "version", false, "[Opiton] Show version")
flag.BoolVar(&params.ShowVersion, "v", false, "[Opiton] Shorthand of -version")
flag.Parse()

if params.ShowVersion {
fmt.Println(Version)
os.Exit(0)
}
if params.GitHubAPIToken == "" {
log.Fatalln("-token is required")
}
Expand Down

0 comments on commit 31ca96a

Please sign in to comment.