Skip to content

Commit 5f7c8e1

Browse files
committed
feat: support for projects_v2 and projects_v2_item webhook events
1 parent 899235e commit 5f7c8e1

File tree

8 files changed

+1102
-0
lines changed

8 files changed

+1102
-0
lines changed

github/event.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
105105
payload = &ProjectCardEvent{}
106106
case "ProjectColumnEvent":
107107
payload = &ProjectColumnEvent{}
108+
case "ProjectV2Event":
109+
payload = &ProjectV2Event{}
110+
case "ProjectV2ItemEvent":
111+
payload = &ProjectV2ItemEvent{}
108112
case "PublicEvent":
109113
payload = &PublicEvent{}
110114
case "PullRequestEvent":

github/event_types.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,77 @@ type ProjectColumnEvent struct {
942942
Installation *Installation `json:"installation,omitempty"`
943943
}
944944

945+
// ProjectV2Event is triggered when there is activity relating to an organization-level project.
946+
// The Webhook event name is "projects_v2"
947+
//
948+
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2
949+
type ProjectV2Event struct {
950+
Action *string `json:"action,omitempty"`
951+
ProjectsV2 *ProjectsV2 `json:"projects_v2,omitempty"`
952+
953+
// The following fields are only populated by Webhook events.
954+
Installation *Installation `json:"installation,omitempty"`
955+
Org *Organization `json:"organization,omitempty"`
956+
Sender *User `json:"sender,omitempty"`
957+
}
958+
959+
// ProjectsV2 represents a projects v2 project.
960+
type ProjectsV2 struct {
961+
ID *int64 `json:"id,omitempty"`
962+
NodeID *string `json:"node_id,omitempty"`
963+
Owner *User `json:"owner,omitempty"`
964+
Creator *User `json:"creator,omitempty"`
965+
Title *string `json:"title,omitempty"`
966+
Description *string `json:"description,omitempty"`
967+
Public *bool `json:"public,omitempty"`
968+
ClosedAt *Timestamp `json:"closed_at,omitempty"`
969+
CreatedAt *Timestamp `json:"created_at,omitempty"`
970+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
971+
DeletedAt *Timestamp `json:"deleted_at,omitempty"`
972+
Number *int `json:"number,omitempty"`
973+
ShortDescription *string `json:"short_description,omitempty"`
974+
DeletedBy *User `json:"deleted_by,omitempty"`
975+
}
976+
977+
// ProjectV2ItemEvent triggered when there is activity relating to an item on an organization-level project.
978+
// The Webhook event name is "projects_v2_item"
979+
//
980+
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item
981+
type ProjectV2ItemEvent struct {
982+
Action *string `json:"action,omitempty"`
983+
Changes *ProjectV2ItemChange `json:"changes,omitempty"`
984+
ProjectV2Item *ProjectV2Item `json:"projects_v2_item,omitempty"`
985+
986+
// The following fields are only populated by Webhook events.
987+
Installation *Installation `json:"installation,omitempty"`
988+
Org *Organization `json:"organization,omitempty"`
989+
Sender *User `json:"sender,omitempty"`
990+
}
991+
992+
// ProjectV2ItemChange represents a project v2 item change.
993+
type ProjectV2ItemChange struct {
994+
ArchivedAt *ArchivedAt `json:"archived_at,omitempty"`
995+
}
996+
997+
// ArchivedAt represents an archiving date change.
998+
type ArchivedAt struct {
999+
From *Timestamp `json:"from,omitempty"`
1000+
To *Timestamp `json:"to,omitempty"`
1001+
}
1002+
1003+
// ProjectsV2 represents an item belonging to a project.
1004+
type ProjectV2Item struct {
1005+
ID *int64 `json:"id,omitempty"`
1006+
NodeID *string `json:"node_id,omitempty"`
1007+
ProjectNodeID *string `json:"project_node_id,omitempty"`
1008+
ContentNodeID *string `json:"content_node_id,omitempty"`
1009+
ContentType *string `json:"content_type,omitempty"`
1010+
Creator *User `json:"creator,omitempty"`
1011+
CreatedAt *Timestamp `json:"created_at,omitempty"`
1012+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
1013+
ArchivedAt *Timestamp `json:"archived_at,omitempty"`
1014+
}
1015+
9451016
// PublicEvent is triggered when a private repository is open sourced.
9461017
// According to GitHub: "Without a doubt: the best GitHub event."
9471018
// The Webhook event name is "public".

0 commit comments

Comments
 (0)