Skip to content

Commit

Permalink
Merge pull request #1001 from paketo-buildpacks/bug-fixes
Browse files Browse the repository at this point in the history
Fix two small bugs
  • Loading branch information
dmikusa authored Feb 13, 2023
2 parents e82b5d7 + 70fcd2b commit 494be67
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion octo/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,22 @@ func ContributeTest(descriptor Descriptor) (*Contribution, error) {
},
}

skipPrefixes := []string{
"paketo-buildpacks",
"paketobuildpacks",
"paketo-community",
"paketocommunity",
}

for _, repo := range descriptor.Package.Repositories {
if !strings.Contains(repo, "paketo-buildpacks") && !strings.Contains(repo, "paketobuildpacks") {
skipMatch := false
for _, skipPrefix := range skipPrefixes {
if strings.Contains(repo, skipPrefix) {
skipMatch = true
break
}
}
if !skipMatch {
j.Steps = append(NewDockerCredentialActions(descriptor.DockerCredentials), j.Steps...)
}
}
Expand Down
16 changes: 15 additions & 1 deletion octo/update_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package octo
import (
"fmt"
"os"
"path/filepath"

"github.com/paketo-buildpacks/pipeline-builder/octo/actions"
"github.com/paketo-buildpacks/pipeline-builder/octo/actions/event"
Expand All @@ -42,7 +43,20 @@ func ContributeUpdateGo(descriptor Descriptor) (*Contribution, error) {
return nil, nil
}

seed := fmt.Sprintf("Update Go %s", os.Getenv("GITHUB_REPOSITORY"))
repoName := os.Getenv("GITHUB_REPOSITORY")
if len(repoName) == 0 {
cwd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("unable to fetch current working directory\n%w", err)
}

// get the repo name, which should like `paketo-buildpacks/foo`
repoName = fmt.Sprintf("%s/%s",
filepath.Base(filepath.Dir(filepath.Dir(cwd))),
filepath.Base(filepath.Dir(cwd)))
}

seed := fmt.Sprintf("Update Go %s", repoName)
cron := jitter.
New(seed).
Jitter(event.Cron{Hour: "2", DayOfWeek: "1", Month: "*", DayOfMonth: "*"})
Expand Down

0 comments on commit 494be67

Please sign in to comment.