Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion check_command_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package resource_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/google/go-github/v66/github"
Expand Down
4 changes: 1 addition & 3 deletions github.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
"golang.org/x/oauth2"
)

// Last run with counterfeiter v6
//go:generate counterfeiter -o fakes/fake_git_hub.go . GitHub

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -o fakes/fake_git_hub.go . GitHub
type GitHub interface {
ListReleases() ([]*github.RepositoryRelease, error)
GetReleaseByTag(tag string) (*github.RepositoryRelease, error)
Expand Down
4 changes: 2 additions & 2 deletions github_graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (g *GitHubClient) listReleasesV4EnterPrice() ([]*github.RepositoryRelease,
} `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"`
}

vars := map[string]interface{}{
vars := map[string]any{
"repositoryOwner": githubv4.String(g.owner),
"repositoryName": githubv4.String(g.repository),
"releaseCursor": (*githubv4.String)(nil),
Expand Down Expand Up @@ -103,7 +103,7 @@ func (g *GitHubClient) listReleasesV4() ([]*github.RepositoryRelease, error) {
} `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"`
}

vars := map[string]interface{}{
vars := map[string]any{
"repositoryOwner": githubv4.String(g.owner),
"repositoryName": githubv4.String(g.repository),
"releaseCursor": (*githubv4.String)(nil),
Expand Down
47 changes: 37 additions & 10 deletions github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package resource_test

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"time"

. "github.com/concourse/github-release-resource"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/google/go-github/v66/github"
Expand Down Expand Up @@ -276,9 +276,36 @@ var _ = Describe("GitHub Client", func() {
Expect(releases).To(HaveLen(3))
Expect(server.ReceivedRequests()).To(HaveLen(2))
Expect(releases).To(Equal([]*github.RepositoryRelease{
{TagName: github.String("xyz"), Name: github.String("xyz"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(32095103), CreatedAt: &github.Timestamp{time.Date(2010, time.October, 01, 00, 58, 07, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.October, 02, 15, 39, 53, 0, time.UTC)}, URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz")},
{TagName: github.String("xyz"), Name: github.String("xyz"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(30230659), CreatedAt: &github.Timestamp{time.Date(2010, time.August, 27, 13, 55, 36, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.August, 27, 17, 18, 06, 0, time.UTC)}, URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz")},
{TagName: github.String("xyq"), Name: github.String("xyq"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(33222243), CreatedAt: &github.Timestamp{time.Date(2010, time.October, 10, 01, 01, 07, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.October, 10, 15, 39, 53, 0, time.UTC)}, URL: github.String("https://github.com/xyq/xyq/releases/tag/xyq")},
{
TagName: github.String("xyz"),
Name: github.String("xyz"),
Draft: github.Bool(false),
Prerelease: github.Bool(false),
ID: github.Int64(32095103),
CreatedAt: &github.Timestamp{Time: time.Date(2010, time.October, 01, 00, 58, 07, 0, time.UTC)},
PublishedAt: &github.Timestamp{Time: time.Date(2010, time.October, 02, 15, 39, 53, 0, time.UTC)},
URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz"),
},
{
TagName: github.String("xyz"),
Name: github.String("xyz"),
Draft: github.Bool(false),
Prerelease: github.Bool(false),
ID: github.Int64(30230659),
CreatedAt: &github.Timestamp{Time: time.Date(2010, time.August, 27, 13, 55, 36, 0, time.UTC)},
PublishedAt: &github.Timestamp{Time: time.Date(2010, time.August, 27, 17, 18, 06, 0, time.UTC)},
URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz"),
},
{
TagName: github.String("xyq"),
Name: github.String("xyq"),
Draft: github.Bool(false),
Prerelease: github.Bool(false),
ID: github.Int64(33222243),
CreatedAt: &github.Timestamp{Time: time.Date(2010, time.October, 10, 01, 01, 07, 0, time.UTC)},
PublishedAt: &github.Timestamp{Time: time.Date(2010, time.October, 10, 15, 39, 53, 0, time.UTC)},
URL: github.String("https://github.com/xyq/xyq/releases/tag/xyq"),
},
}))
})
})
Expand Down Expand Up @@ -574,7 +601,7 @@ var _ = Describe("GitHub Client", func() {
Expect(err).NotTo(HaveOccurred())
defer readCloser.Close()

body, err := ioutil.ReadAll(readCloser)
body, err := io.ReadAll(readCloser)
Expect(err).NotTo(HaveOccurred())
Expect(string(body)).To(Equal(fileContents))
})
Expand Down Expand Up @@ -613,7 +640,7 @@ var _ = Describe("GitHub Client", func() {
Expect(err).NotTo(HaveOccurred())
defer readCloser.Close()

body, err := ioutil.ReadAll(readCloser)
body, err := io.ReadAll(readCloser)
Expect(err).NotTo(HaveOccurred())
Expect(string(body)).To(Equal(redirectFileContents))
})
Expand All @@ -635,7 +662,7 @@ var _ = Describe("GitHub Client", func() {
Expect(err).NotTo(HaveOccurred())
defer readCloser.Close()

body, err := ioutil.ReadAll(readCloser)
body, err := io.ReadAll(readCloser)
Expect(err).NotTo(HaveOccurred())
Expect(string(body)).To(Equal(redirectFileContents))
})
Expand Down Expand Up @@ -663,7 +690,7 @@ var _ = Describe("GitHub Client", func() {
Expect(err).NotTo(HaveOccurred())
defer readCloser.Close()

body, err := ioutil.ReadAll(readCloser)
body, err := io.ReadAll(readCloser)
Expect(err).NotTo(HaveOccurred())
Expect(string(body)).To(Equal(redirectFileContents))
})
Expand Down Expand Up @@ -745,7 +772,7 @@ var _ = Describe("GitHub Client", func() {
Expect(err).NotTo(HaveOccurred())
defer readCloser.Close()

body, err := ioutil.ReadAll(readCloser)
body, err := io.ReadAll(readCloser)
Expect(err).NotTo(HaveOccurred())
Expect(string(body)).To(Equal(redirectFileContents))
})
Expand Down
29 changes: 17 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
module github.com/concourse/github-release-resource

go 1.23
go 1.24.0

toolchain go1.23.2
toolchain go1.24.1

require (
github.com/Masterminds/semver v1.5.0
github.com/cppforlife/go-semi-semantic v0.0.0-20160921010311-576b6af77ae4
github.com/google/go-github/v66 v66.0.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.34.2
github.com/onsi/ginkgo/v2 v2.23.0
github.com/onsi/gomega v1.36.2
github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
)

require (
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/nxadm/tail v1.4.5 // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading