Skip to content

Commit 0071131

Browse files
authored
improve build command logs (#75)
1 parent f67ba91 commit 0071131

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

internal/changelog/builder.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,32 +83,34 @@ func (b Builder) Build(owner, repo string) error {
8383
c := github.NewClient(hc)
8484
graphqlClient := github.NewGraphQLClient(hc)
8585

86+
log.Println("Verifying entries:")
87+
8688
for i, entry := range b.changelog.Entries {
8789
// Filling empty PR fields
8890
if len(entry.LinkedPR) == 0 {
8991

9092
commitHash, err := GetLatestCommitHash(entry.File.Name)
9193
if err != nil {
92-
log.Printf("cannot find commit hash, fill the PR field in changelog: %s", entry.File.Name)
94+
log.Printf("%s: cannot find commit hash, fill the PR field in changelog", entry.File.Name)
9395
continue
9496
}
9597

9698
prIDs, err := FillEmptyPRField(commitHash, owner, repo, c)
9799
if err != nil {
98-
log.Printf("fill the PR field in changelog: %s", entry.File.Name)
100+
log.Printf("%s: fill the PR field in changelog", entry.File.Name)
99101
continue
100102
}
101103

102104
if len(prIDs) > 1 {
103-
log.Printf("multiple PRs found for %s, please remove all but one of them", entry.File.Name)
105+
log.Printf("%s: multiple PRs found, please remove all but one of them", entry.File.Name)
104106
}
105107

106108
b.changelog.Entries[i].LinkedPR = prIDs
107109
} else {
108110
// Applying heuristics to PR fields
109111
originalPR, err := FindOriginalPR(entry.LinkedPR[0], owner, repo, c)
110112
if err != nil {
111-
log.Printf("check if the PR field is correct in changelog: %s", entry.File.Name)
113+
log.Printf("%s: check if the PR field is correct in changelog", entry.File.Name)
112114
continue
113115
}
114116

@@ -121,13 +123,13 @@ func (b Builder) Build(owner, repo string) error {
121123
for _, pr := range entry.LinkedPR {
122124
tempIssues, err := FindIssues(graphqlClient, context.Background(), owner, repo, pr, 50)
123125
if err != nil {
124-
log.Printf("could not find linked issues for pr id: %d", entry.LinkedPR)
126+
log.Printf("%s: could not find linked issues for pr: %s/pull/%d", entry.File.Name, entry.Repository, entry.LinkedPR)
125127
continue
126128
}
127129

128130
linkedIssues = append(linkedIssues, tempIssues...)
129131
if len(linkedIssues) > 1 {
130-
log.Printf("multiple issues found for %s, please remove all but one of them", entry.File.Name)
132+
log.Printf("%s: multiple issues found, please remove all but one of them", entry.File.Name)
131133
}
132134
}
133135

@@ -141,7 +143,7 @@ func (b Builder) Build(owner, repo string) error {
141143
}
142144

143145
outFile := path.Join(b.dest, b.filename)
144-
log.Printf("saving changelog in %s\n", outFile)
146+
log.Printf("saving changelog in: %s\n", outFile)
145147
return afero.WriteFile(b.fs, outFile, data, changelogFilePerm)
146148
}
147149

0 commit comments

Comments
 (0)