feat: Add Issue Dependencies API support#4130
feat: Add Issue Dependencies API support#4130tommaso-moro wants to merge 17 commits intogoogle:masterfrom
Conversation
Add four new methods to IssuesService for the Issue Dependencies REST API (apiVersion 2026-03-10): - ListBlockedBy: list dependencies blocking an issue - AddBlockedBy: add a blocking dependency to an issue - RemoveBlockedBy: remove a blocking dependency - ListBlocking: list issues that an issue is blocking Includes IssueDependencyRequest type, full test coverage with testBadOptions, testNewRequestAndDoFailure, testURLParseError, and testJSONMarshal helpers.
Run go generate to add: - GetIssueID accessor for IssueDependencyRequest - ListBlockedBy and ListBlocking iterators with tests
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4130 +/- ##
==========================================
+ Coverage 93.74% 93.76% +0.02%
==========================================
Files 211 212 +1
Lines 19685 19765 +80
==========================================
+ Hits 18453 18533 +80
Misses 1034 1034
Partials 198 198 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @tommaso-moro!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode
|
@Not-Dhananjay-Mishra thank you for the review! I have addressed the points you raised and updated this branch. |
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
…dependencies.go Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Per review feedback: both issue_id and issue_number are integer in the OpenAPI spec, so issueNumber should be int64 for consistency.
| BlockedBy *int `json:"blocked_by,omitempty"` | ||
| Blocking *int `json:"blocking,omitempty"` | ||
| TotalBlockedBy *int `json:"total_blocked_by,omitempty"` | ||
| TotalBlocking *int `json:"total_blocking,omitempty"` |
There was a problem hiding this comment.
All these fields are required according to the schema:
| BlockedBy *int `json:"blocked_by,omitempty"` | |
| Blocking *int `json:"blocking,omitempty"` | |
| TotalBlockedBy *int `json:"total_blocked_by,omitempty"` | |
| TotalBlocking *int `json:"total_blocking,omitempty"` | |
| BlockedBy int `json:"blocked_by"` | |
| Blocking int `json:"blocking"` | |
| TotalBlockedBy int `json:"total_blocked_by"` | |
| TotalBlocking int `json:"total_blocking"` |
| Total *int `json:"total,omitempty"` | ||
| Completed *int `json:"completed,omitempty"` | ||
| PercentCompleted *int `json:"percent_completed,omitempty"` |
There was a problem hiding this comment.
| Total *int `json:"total,omitempty"` | |
| Completed *int `json:"completed,omitempty"` | |
| PercentCompleted *int `json:"percent_completed,omitempty"` | |
| Total int `json:"total"` | |
| Completed int `json:"completed"` | |
| PercentCompleted int `json:"percent_completed"` |
| IssueFieldID *int64 `json:"issue_field_id,omitempty"` | ||
| NodeID *string `json:"node_id,omitempty"` | ||
| DataType *string `json:"data_type,omitempty"` |
There was a problem hiding this comment.
| IssueFieldID *int64 `json:"issue_field_id,omitempty"` | |
| NodeID *string `json:"node_id,omitempty"` | |
| DataType *string `json:"data_type,omitempty"` | |
| IssueFieldID int64 `json:"issue_field_id"` | |
| NodeID string `json:"node_id"` | |
| DataType string `json:"data_type"` |
| ID *int64 `json:"id,omitempty"` | ||
| Name *string `json:"name,omitempty"` | ||
| Color *string `json:"color,omitempty"` |
There was a problem hiding this comment.
| ID *int64 `json:"id,omitempty"` | |
| Name *string `json:"name,omitempty"` | |
| Color *string `json:"color,omitempty"` | |
| ID int64 `json:"id"` | |
| Name string `json:"name"` | |
| Color string `json:"color"` |
| IssueFieldID *int64 `json:"issue_field_id,omitempty"` | ||
| NodeID *string `json:"node_id,omitempty"` | ||
| DataType *string `json:"data_type,omitempty"` | ||
| Value any `json:"value,omitempty"` |
There was a problem hiding this comment.
| Value any `json:"value,omitempty"` | |
| Value any `json:"value"` |
There was a problem hiding this comment.
I propose adding the comment that the value can be string, number, or integer.
| // 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, issueNumber int64, issueID int64) (*Issue, *Response, error) { |
There was a problem hiding this comment.
| func (s *IssuesService) RemoveBlockedBy(ctx context.Context, owner, repo string, issueNumber int64, issueID int64) (*Issue, *Response, error) { | |
| func (s *IssuesService) RemoveBlockedBy(ctx context.Context, owner, repo string, issueNumber, issueID int64) (*Issue, *Response, error) { |
closes: #4129
Add Issue Dependencies API support
Add support for the Issue Dependencies REST API.
Changes
New file
github/issues_dependencies.goadds four methods toIssuesService:ListBlockedByGET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_byAddBlockedByPOST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_byRemoveBlockedByDELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}ListBlockingGET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blockingAlso adds
IssueDependencyRequesttype used byAddBlockedBy.Testing
Full test coverage in
github/issues_dependencies_test.go(12 tests) using standard helpers:testBadOptions,testNewRequestAndDoFailure,testURLParseError,testJSONMarshal.Auto-generated files updated via
go generate: accessors, accessor tests, iterators, and iterator tests.All scripts pass:
script/fmt.sh,script/test.sh,script/lint.sh.