Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
752e454
feat: Add Issue Dependencies API support
tommaso-moro Apr 2, 2026
9aba995
chore: Regenerate accessors and iterators
tommaso-moro Apr 2, 2026
f57a237
chore: trigger CI
tommaso-moro Apr 2, 2026
76cfab3
remove omitempty for required param
tommaso-moro Apr 3, 2026
4550de5
pass by value instead of reference as param is required
tommaso-moro Apr 3, 2026
13f260e
add missing fields to Issue struct
tommaso-moro Apr 8, 2026
14b279b
Merge branch 'master' into tommy/issue-dependencies-support
tommaso-moro Apr 8, 2026
6fd4bfd
use any instead of interface{}
tommaso-moro Apr 9, 2026
171deba
Use int64 instead of *int64 for IssueID
tommaso-moro Apr 9, 2026
c5e05bf
Update number param to issueNumber for consistency, in github/issues_…
tommaso-moro Apr 9, 2026
1d84d92
Update number param to issueNumber in github/issues_dependencies.go
tommaso-moro Apr 9, 2026
a3c6983
update number param to issueNumber
tommaso-moro Apr 9, 2026
45fb09c
fix tests now that IssueID is of type int64
tommaso-moro Apr 9, 2026
1e86822
update number param to issueNumber
tommaso-moro Apr 9, 2026
0000b64
Use int64 for issueNumber parameter
tommaso-moro Apr 9, 2026
d261d4f
clean up test
tommaso-moro Apr 9, 2026
f4e9158
Merge branch 'master' into tommy/issue-dependencies-support
tommaso-moro Apr 9, 2026
394a89c
Merge branch 'master' into tommy/issue-dependencies-support
tommaso-moro Apr 20, 2026
23de54e
fix types
tommaso-moro Apr 20, 2026
8f1e865
use shorthand or types
tommaso-moro Apr 20, 2026
f4515f7
go generate
tommaso-moro Apr 20, 2026
f207870
go generate
tommaso-moro Apr 20, 2026
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
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions github/github-iterators.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

144 changes: 144 additions & 0 deletions github/github-iterators_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions github/issues_dependencies.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
"context"
"fmt"
)

// IssueDependencyRequest represents a request to add a dependency to an issue.
type IssueDependencyRequest struct {
IssueID *int64 `json:"issue_id,omitempty"`
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
}

// ListBlockedBy lists the dependencies that block the specified issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies#list-dependencies-an-issue-is-blocked-by
//
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by
func (s *IssuesService) ListBlockedBy(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Issue, *Response, error) {
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by", owner, repo, number)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}

var issues []*Issue
resp, err := s.client.Do(ctx, req, &issues)
if err != nil {
return nil, resp, err
}

return issues, resp, nil
}

// AddBlockedBy adds a "blocked by" dependency to the specified issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies#add-a-dependency-an-issue-is-blocked-by
//
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by
func (s *IssuesService) AddBlockedBy(ctx context.Context, owner, repo string, number int, issueDepReq *IssueDependencyRequest) (*Issue, *Response, error) {
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by", owner, repo, number)
req, err := s.client.NewRequest("POST", u, issueDepReq)
if err != nil {
return nil, nil, err
}

var issue *Issue
resp, err := s.client.Do(ctx, req, &issue)
if err != nil {
return nil, resp, err
}

return issue, resp, nil
}

// RemoveBlockedBy removes a "blocked by" dependency from the specified issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies#remove-dependency-an-issue-is-blocked-by
//
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}
func (s *IssuesService) RemoveBlockedBy(ctx context.Context, owner, repo string, number int, issueID int64) (*Issue, *Response, error) {
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by/%v", owner, repo, number, issueID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, nil, err
}

var issue *Issue
resp, err := s.client.Do(ctx, req, &issue)
if err != nil {
return nil, resp, err
}

return issue, resp, nil
}

// ListBlocking lists the issues that the specified issue is blocking.
//
// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies#list-dependencies-an-issue-is-blocking
//
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking
func (s *IssuesService) ListBlocking(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Issue, *Response, error) {
Comment thread
tommaso-moro marked this conversation as resolved.
Outdated
u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocking", owner, repo, number)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}

var issues []*Issue
resp, err := s.client.Do(ctx, req, &issues)
if err != nil {
return nil, resp, err
}

return issues, resp, nil
}
Loading
Loading