Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(repo)!: add topics field to build env and repo #807

Merged
merged 19 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 17 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
347 changes: 199 additions & 148 deletions api/webhook.go

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions compiler/native/environment_test.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions database/repo/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ func TestRepo_Engine_CreateRepo(t *testing.T) {

// ensure the mock expects the query
_mock.ExpectQuery(`INSERT INTO "repos"
("user_id","hash","org","name","full_name","link","clone","branch","build_limit","timeout","counter","visibility","private","trusted","active","allow_pull","allow_push","allow_deploy","allow_tag","allow_comment","pipeline_type","previous_name","id")
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) RETURNING "id"`).
WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, "yaml", "oldName", 1).
("user_id","hash","org","name","full_name","link","clone","branch","topics","build_limit","timeout","counter","visibility","private","trusted","active","allow_pull","allow_push","allow_deploy","allow_tag","allow_comment","pipeline_type","previous_name","id")
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24) RETURNING "id"`).
WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, "yaml", "oldName", 1).
WillReturnRows(_rows)

_sqlite := testSqlite(t)
Expand Down
5 changes: 3 additions & 2 deletions database/repo/get_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ func TestRepo_Engine_GetRepoForOrg(t *testing.T) {
_repo.SetFullName("foo/bar")
_repo.SetVisibility("public")
_repo.SetPipelineType("yaml")
_repo.SetTopics([]string{})

_postgres, _mock := testPostgres(t)
defer func() { _sql, _ := _postgres.client.DB(); _sql.Close() }()

// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", "")
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", "")

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 AND name = $2 LIMIT 1`).WithArgs("foo", "bar").WillReturnRows(_rows)
Expand Down
5 changes: 3 additions & 2 deletions database/repo/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ func TestRepo_Engine_GetRepo(t *testing.T) {
_repo.SetFullName("foo/bar")
_repo.SetVisibility("public")
_repo.SetPipelineType("yaml")
_repo.SetTopics([]string{})

_postgres, _mock := testPostgres(t)
defer func() { _sql, _ := _postgres.client.DB(); _sql.Close() }()

// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", "")
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", "")

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "repos" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows)
Expand Down
14 changes: 8 additions & 6 deletions database/repo/list_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) {
_repoOne.SetFullName("foo/bar")
_repoOne.SetVisibility("public")
_repoOne.SetPipelineType("yaml")
_repoOne.SetTopics([]string{})

_repoTwo := testRepo()
_repoTwo.SetID(2)
Expand All @@ -48,6 +49,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) {
_repoTwo.SetFullName("foo/baz")
_repoTwo.SetVisibility("public")
_repoTwo.SetPipelineType("yaml")
_repoTwo.SetTopics([]string{})

_postgres, _mock := testPostgres(t)
defer func() { _sql, _ := _postgres.client.DB(); _sql.Close() }()
Expand All @@ -60,9 +62,9 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) {

// create expected name query result in mock
_rows = sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)

// ensure the mock expects the name query
_mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 ORDER BY name LIMIT 10`).WithArgs("foo").WillReturnRows(_rows)
Expand All @@ -75,9 +77,9 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) {

// create expected latest query result in mock
_rows = sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)

// ensure the mock expects the latest query
_mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.org = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT 10`).WithArgs("foo").WillReturnRows(_rows)
Expand Down
8 changes: 5 additions & 3 deletions database/repo/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestRepo_Engine_ListRepos(t *testing.T) {
_repoOne.SetFullName("foo/bar")
_repoOne.SetVisibility("public")
_repoOne.SetPipelineType("yaml")
_repoOne.SetTopics([]string{})

_repoTwo := testRepo()
_repoTwo.SetID(2)
Expand All @@ -33,6 +34,7 @@ func TestRepo_Engine_ListRepos(t *testing.T) {
_repoTwo.SetFullName("bar/foo")
_repoTwo.SetVisibility("public")
_repoTwo.SetPipelineType("yaml")
_repoTwo.SetTopics([]string{})

_postgres, _mock := testPostgres(t)
defer func() { _sql, _ := _postgres.client.DB(); _sql.Close() }()
Expand All @@ -45,9 +47,9 @@ func TestRepo_Engine_ListRepos(t *testing.T) {

// create expected result in mock
_rows = sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "repos"`).WillReturnRows(_rows)
Expand Down
14 changes: 8 additions & 6 deletions database/repo/list_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) {
_repoOne.SetFullName("foo/bar")
_repoOne.SetVisibility("public")
_repoOne.SetPipelineType("yaml")
_repoOne.SetTopics([]string{})

_repoTwo := testRepo()
_repoTwo.SetID(2)
Expand All @@ -48,6 +49,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) {
_repoTwo.SetFullName("bar/foo")
_repoTwo.SetVisibility("public")
_repoTwo.SetPipelineType("yaml")
_repoTwo.SetTopics([]string{})

_user := new(library.User)
_user.SetID(1)
Expand All @@ -65,9 +67,9 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) {

// create expected name query result in mock
_rows = sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)

// ensure the mock expects the name query
_mock.ExpectQuery(`SELECT * FROM "repos" WHERE user_id = $1 ORDER BY name LIMIT 10`).WithArgs(1).WillReturnRows(_rows)
Expand All @@ -80,9 +82,9 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) {

// create expected latest query result in mock
_rows = sqlmock.NewRows(
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)
[]string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "pipeline_type", "previous_name"}).
AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil).
AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, "yaml", nil)

// ensure the mock expects the latest query
_mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.user_id = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT 10`).WithArgs(1).WillReturnRows(_rows)
Expand Down
2 changes: 2 additions & 0 deletions database/repo/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ repos (
link VARCHAR(1000),
clone VARCHAR(1000),
branch VARCHAR(250),
topics VARCHAR(1020),
build_limit INTEGER,
timeout INTEGER,
counter INTEGER,
Expand Down Expand Up @@ -53,6 +54,7 @@ repos (
link TEXT,
clone TEXT,
branch TEXT,
topics TEXT,
build_limit INTEGER,
timeout INTEGER,
counter INTEGER,
Expand Down
6 changes: 3 additions & 3 deletions database/repo/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func TestRepo_Engine_UpdateRepo(t *testing.T) {

// ensure the mock expects the query
_mock.ExpectExec(`UPDATE "repos"
SET "user_id"=$1,"hash"=$2,"org"=$3,"name"=$4,"full_name"=$5,"link"=$6,"clone"=$7,"branch"=$8,"build_limit"=$9,"timeout"=$10,"counter"=$11,"visibility"=$12,"private"=$13,"trusted"=$14,"active"=$15,"allow_pull"=$16,"allow_push"=$17,"allow_deploy"=$18,"allow_tag"=$19,"allow_comment"=$20,"pipeline_type"=$21,"previous_name"=$22
WHERE "id" = $23`).
WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, "yaml", "oldName", 1).
SET "user_id"=$1,"hash"=$2,"org"=$3,"name"=$4,"full_name"=$5,"link"=$6,"clone"=$7,"branch"=$8,"topics"=$9,"build_limit"=$10,"timeout"=$11,"counter"=$12,"visibility"=$13,"private"=$14,"trusted"=$15,"active"=$16,"allow_pull"=$17,"allow_push"=$18,"allow_deploy"=$19,"allow_tag"=$20,"allow_comment"=$21,"pipeline_type"=$22,"previous_name"=$23
WHERE "id" = $24`).
WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, "yaml", "oldName", 1).
WillReturnResult(sqlmock.NewResult(1, 1))

_sqlite := testSqlite(t)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/drone/envsubst v1.0.3
github.com/gin-gonic/gin v1.9.0
github.com/go-playground/assert/v2 v2.2.0
github.com/go-vela/types v0.18.2-0.20230321015315-6c723879639c
github.com/go-vela/types v0.18.2-0.20230407145744-676c45c911b5
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.5.9
github.com/google/go-github/v50 v50.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyh
github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
github.com/go-vela/types v0.18.2-0.20230321015315-6c723879639c h1:lnCL1knUGvgZQG4YBHSs/CZnxNBfqFUBlGhyq9LO9uk=
github.com/go-vela/types v0.18.2-0.20230321015315-6c723879639c/go.mod h1:6MzMhLaXKSZ9wiJveieqnBd2+4ZMS7yv7+POGSITyS8=
github.com/go-vela/types v0.18.2-0.20230407145744-676c45c911b5 h1:fkxgJa0ispCsLsUHaEImsLPFUhFRrAQPoA3a1XlARxQ=
github.com/go-vela/types v0.18.2-0.20230407145744-676c45c911b5/go.mod h1:6MzMhLaXKSZ9wiJveieqnBd2+4ZMS7yv7+POGSITyS8=
github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA=
github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down
1 change: 1 addition & 0 deletions router/middleware/repo/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestRepo_Establish(t *testing.T) {
want.SetLink("")
want.SetClone("")
want.SetBranch("")
want.SetTopics([]string{})
want.SetBuildLimit(0)
want.SetTimeout(0)
want.SetCounter(0)
Expand Down
1 change: 1 addition & 0 deletions scm/github/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ func toLibraryRepo(gr github.Repository) *library.Repo {
Link: gr.HTMLURL,
Clone: gr.CloneURL,
Branch: gr.DefaultBranch,
Topics: &gr.Topics,
Private: gr.Private,
}
}
Expand Down
2 changes: 2 additions & 0 deletions scm/github/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ func TestGithub_GetRepo(t *testing.T) {
want.SetClone("https://github.com/octocat/Hello-World.git")
want.SetBranch("master")
want.SetPrivate(false)
want.SetTopics([]string{"octocat", "atom", "electron", "api"})

client, _ := NewTest(s.URL)

Expand Down Expand Up @@ -1188,6 +1189,7 @@ func TestGithub_ListUserRepos(t *testing.T) {
r.SetClone("https://github.com/octocat/Hello-World.git")
r.SetBranch("master")
r.SetPrivate(false)
r.SetTopics([]string{"octocat", "atom", "electron", "api"})

want := []*library.Repo{r}

Expand Down
6 changes: 5 additions & 1 deletion scm/github/testdata/hooks/repository_edited.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@
"forks": 0,
"open_issues": 2,
"watchers": 0,
"default_branch": "main"
"default_branch": "main",
"topics": [
"cloud",
"security"
]
},
"enterprise": {
"id": 1,
Expand Down
6 changes: 6 additions & 0 deletions scm/github/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ func (c *client) processPushEvent(h *library.Hook, payload *github.PushEvent) (*
r.SetClone(repo.GetCloneURL())
r.SetBranch(repo.GetDefaultBranch())
r.SetPrivate(repo.GetPrivate())
// uncomment this line when next version (>v51.0.0) of go-github is released
// r.SetTopics(repo.Topics)

// convert payload to library build
b := new(library.Build)
Expand Down Expand Up @@ -234,6 +236,7 @@ func (c *client) processPREvent(h *library.Hook, payload *github.PullRequestEven
r.SetClone(repo.GetCloneURL())
r.SetBranch(repo.GetDefaultBranch())
r.SetPrivate(repo.GetPrivate())
r.SetTopics(repo.Topics)

// convert payload to library build
b := new(library.Build)
Expand Down Expand Up @@ -300,6 +303,7 @@ func (c *client) processDeploymentEvent(h *library.Hook, payload *github.Deploym
r.SetClone(repo.GetCloneURL())
r.SetBranch(repo.GetDefaultBranch())
r.SetPrivate(repo.GetPrivate())
r.SetTopics(repo.Topics)

// convert payload to library build
b := new(library.Build)
Expand Down Expand Up @@ -401,6 +405,7 @@ func (c *client) processIssueCommentEvent(h *library.Hook, payload *github.Issue
r.SetClone(repo.GetCloneURL())
r.SetBranch(repo.GetDefaultBranch())
r.SetPrivate(repo.GetPrivate())
r.SetTopics(repo.Topics)

// convert payload to library build
b := new(library.Build)
Expand Down Expand Up @@ -451,6 +456,7 @@ func (c *client) processRepositoryEvent(h *library.Hook, payload *github.Reposit
r.SetBranch(repo.GetDefaultBranch())
r.SetPrivate(repo.GetPrivate())
r.SetActive(!repo.GetArchived())
r.SetTopics(repo.Topics)

// if action is renamed, then get the previous name from payload
if payload.GetAction() == "renamed" {
Expand Down
Loading