Skip to content

Commit

Permalink
Fix template of commits
Browse files Browse the repository at this point in the history
  • Loading branch information
odanado committed Nov 17, 2024
1 parent fbf1fba commit 0ae3f3a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-pr-release.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Nothing.
# Commits

{{#commits}}
- [{{commit.message}}]({{sha}})
- {{commit.message}}: {{sha}}
{{/commits}}
{{^commits}}
Nothing.
Expand Down
45 changes: 45 additions & 0 deletions hoge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"context"
"fmt"
"os"
)

func exitWithError(err error) {

Check failure on line 9 in hoge.go

View workflow job for this annotation

GitHub Actions / build

other declaration of exitWithError

Check failure on line 9 in hoge.go

View workflow job for this annotation

GitHub Actions / create-release-pr

other declaration of exitWithError
fmt.Fprintln(os.Stderr, "Error: ", err)
os.Exit(1)
}

func main() {

Check failure on line 14 in hoge.go

View workflow job for this annotation

GitHub Actions / build

other declaration of main

Check failure on line 14 in hoge.go

View workflow job for this annotation

GitHub Actions / create-release-pr

other declaration of main

fmt.Println("Hello, world!")

owner := "odanado"
repo := "git-pr-release-go"
githubToken := os.Getenv("GH_TOKEN")

client := NewClient(GithubClientOptions{owner: owner, repo: repo, githubToken: githubToken})

ctx := context.Background()
from := "main"
to := "release/cli"

totalCommits, pullRequests, commits, err := client.FetchChanges(ctx, from, to)

if err != nil {
exitWithError(err)
}

fmt.Println("Total commits: ", totalCommits)
fmt.Println("Pull requests: ", len(pullRequests))
for _, pr := range pullRequests {
fmt.Println(" ", pr.GetNumber(), pr.GetTitle())
}

fmt.Println("Commits: ")
for _, commit := range commits {
fmt.Println(" ", commit.GetSHA(), commit.GetCommit().GetMessage())
}

}

0 comments on commit 0ae3f3a

Please sign in to comment.