Skip to content

Commit

Permalink
Merge pull request #462 from jenkins-x/createlatest
Browse files Browse the repository at this point in the history
 fix: github now requires explicit make_latest=true on create
  • Loading branch information
jenkins-x-bot authored Nov 1, 2024
2 parents 4b6f912 + d95cc43 commit af08d2b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ linux: build
check: fmt lint sec ## Runs Go format check as well as security checks

get-fmt-deps:
$(GO_NOMOD) get golang.org/x/tools/cmd/goimports
$(GO_NOMOD) install golang.org/x/tools/cmd/goimports

.PHONY: importfmt
importfmt: get-fmt-deps ## Checks the import format of the Go source files
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module github.com/jenkins-x/go-scm

require (
code.gitea.io/sdk/gitea v0.14.0
fortio.org/safecast v1.0.0
github.com/bluekeyes/go-gitdiff v0.8.0
github.com/go-git/go-billy/v5 v5.5.0
github.com/go-git/go-git/v5 v5.12.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ code.gitea.io/sdk/gitea v0.14.0 h1:m4J352I3p9+bmJUfS+g0odeQzBY/5OXP91Gv6D4fnJ0=
code.gitea.io/sdk/gitea v0.14.0/go.mod h1:89WiyOX1KEcvjP66sRHdu0RafojGo60bT9UqW17VbWs=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
fortio.org/safecast v1.0.0 h1:dr3131WPX8iS1pTf76+39WeXbTrerDYLvi9s7Oi3wiY=
fortio.org/safecast v1.0.0/go.mod h1:xZmcPk3vi4kuUFf+tq4SvnlVdwViqf6ZSZl91Jr9Jdg=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
Expand Down
6 changes: 4 additions & 2 deletions scm/driver/azure/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"net/url"
"strings"

"fortio.org/safecast"

"github.com/jenkins-x/go-scm/scm"
)

Expand Down Expand Up @@ -223,8 +225,8 @@ func convertRepositoryList(from *repositories, options *scm.ListOptions) []*scm.
var to []*scm.Repository

paging := options.Size > 0
start := uint64(options.Page * options.Size)
end := start + uint64(options.Size)
start := safecast.MustConvert[uint64](options.Page * options.Size)
end := start + safecast.MustConvert[uint64](options.Size)

var curr uint64
for _, v := range from.Value {
Expand Down
3 changes: 2 additions & 1 deletion scm/driver/gitea/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"

"code.gitea.io/sdk/gitea"
"fortio.org/safecast"
"github.com/jenkins-x/go-scm/scm"
)

Expand Down Expand Up @@ -114,7 +115,7 @@ func convertReviewComment(src *gitea.PullReviewComment) *scm.ReviewComment {
Body: src.Body,
Path: src.Path,
Sha: src.CommitID,
Line: int(src.LineNum),
Line: safecast.MustConvert[int](src.LineNum),
Link: src.HTMLURL,
Author: *convertUser(src.Reviewer),
Created: src.Created,
Expand Down
3 changes: 3 additions & 0 deletions scm/driver/github/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func (s *releaseService) Create(ctx context.Context, repo string, input *scm.Rel
Prerelease: input.Prerelease,
Tag: input.Tag,
}
if !(in.Prerelease || in.Draft) {
in.MakeLatest = "true"
}
out := new(release)
res, err := s.client.do(ctx, "POST", path, in, out)
return convertRelease(out), res, err
Expand Down

0 comments on commit af08d2b

Please sign in to comment.