Skip to content

Commit

Permalink
install: Improve log messages
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Augustus <foo@auggie.dev>
  • Loading branch information
justaugustus committed Aug 22, 2022
1 parent 71bff45 commit de6c4cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion install/github/github.go
Expand Up @@ -195,8 +195,9 @@ func (c *Client) CreatePullRequest(
}

log.Printf(
"successfully created PR #%d: %s",
"successfully created PR #%d for repository %s: %s",
pr.GetNumber(),
repo,
pr.GetHTMLURL(),
)

Expand Down
16 changes: 9 additions & 7 deletions install/install.go
Expand Up @@ -72,6 +72,7 @@ func Run(o *options.Options) error {

// If not provided, get all repositories under organization.
if len(o.Repositories) == 0 {
log.Print("No repositories provided. Fetching all repositories under organization.")
repos, _, err := gh.GetRepositoriesByOrg(ctx, o.Owner)
if err != nil {
return fmt.Errorf("getting repos for owner (%s): %w", o.Owner, err)
Expand All @@ -93,6 +94,7 @@ func Run(o *options.Options) error {
// TODO: Capture repo access errors
for _, repoName := range o.Repositories {
// Get repo metadata.
log.Printf("getting repo metadata for %s", repoName)
repo, _, err := gh.GetRepository(ctx, o.Owner, repoName)
if err != nil {
log.Printf(
Expand Down Expand Up @@ -150,7 +152,7 @@ func Run(o *options.Options) error {
break
}
if err != nil && i == len(workflowFiles)-1 {
log.Printf("checking for scorecard workflow file: %+v", err)
log.Printf("could not find a scorecard workflow file: %+v", err)
}
}

Expand All @@ -165,7 +167,7 @@ func Run(o *options.Options) error {
)
if scorecardBranch != nil || err == nil {
log.Printf(
"skipped repo (%s) since the scorecard branch already exists",
"skipped repo (%s) since the scorecard action installation branch already exists",
repoName,
)

Expand Down Expand Up @@ -233,12 +235,12 @@ func Run(o *options.Options) error {

continue
}

log.Printf(
"Created a pull request to add the scorecard workflow to %s",
repoName,
)
}

log.Printf(
"finished processing repository %s",
repoName,
)
}

return nil
Expand Down

0 comments on commit de6c4cd

Please sign in to comment.