Skip to content

Commit

Permalink
fix: fix repo fields (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke authored Jul 23, 2024
1 parent c51ed83 commit 4b070d2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
19 changes: 14 additions & 5 deletions ghproj.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ entries:
-project:suzuki-shunsuke/5
archived:false
owner:suzuki-shunsuke
owner:aquaproj
owner:lintnet
is:public
expr: |
(! Item.Repo.IsFork) &&
(Item.Title != "Dependency Dashboard")
(Item.Title != "Dependency Dashboard") &&
! (Item.Repo.Name startsWith "homebrew-") &&
! (Item.Repo.Name startsWith "test-")
project_id: PVT_kwHOAMtMJ84AQCf4
# type: issue, pr
# title
Expand All @@ -21,7 +25,12 @@ entries:
# datetime created, updated, closed, merged
# OR
# - expr: |
# (Item.Open && Item.Repo.IsArchived) ||
# (Item.Title == "Dependency Dashboard")
# action: archive
# project_id: PVT_kwHOAMtMJ84AQCf4
# Item.Repo.IsArchived ||
# (Item.Title == "Dependency Dashboard") ||
# Item.Repo.IsFork ||
# (Item.Repo.Name startsWith "homebrew-") ||
# (Item.Repo.Name startsWith "test-")
- expr: |
! Item.Open || Item.Repo.IsArchived
action: archive
project_id: PVT_kwHOAMtMJ84AQCf4
4 changes: 2 additions & 2 deletions pkg/github/list_project_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (c *Client) ListItems(ctx context.Context, projectID string) ([]*Item, erro
Author: node.Content.Issue.Author.Login,
Repo: Repo{
Owner: node.Content.Issue.Repository.Owner.Login,
Repo: node.Content.Issue.Repository.Name,
Name: node.Content.Issue.Repository.Name,
IsArchived: node.Content.Issue.Repository.IsArchived,
IsFork: node.Content.Issue.Repository.IsFork,
},
Expand All @@ -175,7 +175,7 @@ func (c *Client) ListItems(ctx context.Context, projectID string) ([]*Item, erro
Author: node.Content.PullRequest.Author.Login,
Repo: Repo{
Owner: node.Content.Issue.Repository.Owner.Login,
Repo: node.Content.Issue.Repository.Name,
Name: node.Content.Issue.Repository.Name,
IsArchived: node.Content.Issue.Repository.IsArchived,
IsFork: node.Content.Issue.Repository.IsFork,
},
Expand Down
20 changes: 11 additions & 9 deletions pkg/github/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Item struct {

type Repo struct {
Owner string
Repo string
Name string
IsArchived bool
IsFork bool
}
Expand All @@ -33,16 +33,12 @@ func (c *Client) SearchItems(ctx context.Context, query string) ([]*Item, error)
Issue struct {
ID githubv4.String
Title githubv4.String
Repository struct {
IsFork bool
}
Repository Repository
} `graphql:"... on Issue"`
PullRequest struct {
ID githubv4.String
Title githubv4.String
Repository struct {
IsFork bool
}
Repository Repository
} `graphql:"... on PullRequest"`
}
PageInfo struct {
Expand All @@ -69,15 +65,21 @@ func (c *Client) SearchItems(ctx context.Context, query string) ([]*Item, error)
ID: string(node.Issue.ID),
Title: string(node.Issue.Title),
Repo: Repo{
IsFork: node.Issue.Repository.IsFork,
Owner: node.Issue.Repository.Owner.Login,
Name: node.Issue.Repository.Name,
IsArchived: node.Issue.Repository.IsArchived,
IsFork: node.Issue.Repository.IsFork,
},
}
case node.PullRequest.Title != "":
item = &Item{
ID: string(node.PullRequest.ID),
Title: string(node.PullRequest.Title),
Repo: Repo{
IsFork: node.PullRequest.Repository.IsFork,
Owner: node.PullRequest.Repository.Owner.Login,
Name: node.PullRequest.Repository.Name,
IsArchived: node.PullRequest.Repository.IsArchived,
IsFork: node.PullRequest.Repository.IsFork,
},
}
default:
Expand Down

0 comments on commit 4b070d2

Please sign in to comment.