Skip to content

Commit 5c61abe

Browse files
authored
Add update project item tool (#1194)
* Add update project item tool * Update docs * Add tests and tool snaps * Remove unnecessary comments * Formatting and fixes * Extract error messages to const * Fix json tag * Rename field * Update params * Update test * Update tool example
1 parent bbfc44c commit 5c61abe

File tree

6 files changed

+619
-62
lines changed

6 files changed

+619
-62
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ The following sets of tools are available (all are on by default):
806806
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
807807
- `query`: Filter projects by a search query (matches title and description) (string, optional)
808808

809+
- **update_project_item** - Update project item
810+
- `item_id`: The unique identifier of the project item. This is not the issue or pull request ID. (number, required)
811+
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
812+
- `owner_type`: Owner type (string, required)
813+
- `project_number`: The project's number. (number, required)
814+
- `updated_field`: Object consisting of the ID of the project field to update and the new value for the field. To clear the field, set "value" to null. Example: {"id": 123456, "value": "New Value"} (object, required)
815+
809816
</details>
810817

811818
<details>

pkg/github/__toolsnaps__/update_project_item.snap

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
"description": "Update a specific Project item for a user or org",
77
"inputSchema": {
88
"properties": {
9-
"fields": {
10-
"description": "A list of field updates to apply.",
11-
"type": "array"
12-
},
139
"item_id": {
14-
"description": "The numeric ID of the project item to update (not the issue or pull request ID).",
10+
"description": "The unique identifier of the project item. This is not the issue or pull request ID.",
1511
"type": "number"
1612
},
1713
"owner": {
@@ -29,14 +25,19 @@
2925
"project_number": {
3026
"description": "The project's number.",
3127
"type": "number"
28+
},
29+
"updated_field": {
30+
"description": "Object consisting of the ID of the project field to update and the new value for the field. To clear the field, set \"value\" to null. Example: {\"id\": 123456, \"value\": \"New Value\"}",
31+
"properties": {},
32+
"type": "object"
3233
}
3334
},
3435
"required": [
3536
"owner_type",
3637
"owner",
3738
"project_number",
3839
"item_id",
39-
"fields"
40+
"updated_field"
4041
],
4142
"type": "object"
4243
},

pkg/github/minimal_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ type MinimalProject struct {
134134
type MinimalProjectItem struct {
135135
ID *int64 `json:"id,omitempty"`
136136
NodeID *string `json:"node_id,omitempty"`
137+
Title *string `json:"title,omitempty"`
138+
Description *string `json:"description,omitempty"`
137139
ProjectNodeID *string `json:"project_node_id,omitempty"`
138140
ContentNodeID *string `json:"content_node_id,omitempty"`
139141
ProjectURL *string `json:"project_url,omitempty"`
@@ -192,6 +194,8 @@ func convertToMinimalProjectItem(item *projectV2Item) *MinimalProjectItem {
192194
return &MinimalProjectItem{
193195
ID: item.ID,
194196
NodeID: item.NodeID,
197+
Title: item.Title,
198+
Description: item.Description,
195199
ProjectNodeID: item.ProjectNodeID,
196200
ContentNodeID: item.ContentNodeID,
197201
ProjectURL: item.ProjectURL,

0 commit comments

Comments
 (0)