yaju-is-always-watching-you/internal/forgejo/payload.go
awayatan f47fef177b
Some checks failed
CI / test (push) Failing after 4s
Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot
Watches issue/PR comments and pushes for flagged phrases; warns commenters
via reply and opens a redacted correction PR for flagged file content,
never rewriting history or deleting content directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 22:47:12 +09:00

52 lines
1.5 KiB
Go

package forgejo
// The structs below are minimal subsets of the Forgejo/Gitea webhook JSON
// payloads (https://forgejo.org/docs/latest/user/webhooks/) — only the
// fields yaju-keisatsu actually reads.
type WebhookUser struct {
Login string `json:"login"`
}
type WebhookRepository struct {
Name string `json:"name"`
FullName string `json:"full_name"`
Owner WebhookUser `json:"owner"`
DefaultBranch string `json:"default_branch"`
}
type WebhookIssue struct {
Number int64 `json:"number"`
Body string `json:"body"`
}
type WebhookComment struct {
Body string `json:"body"`
User WebhookUser `json:"user"`
}
// IssueCommentPayload is the body of a Forgejo "issue_comment" webhook
// event. It fires for comments on both issues and pull requests.
type IssueCommentPayload struct {
Action string `json:"action"`
Issue WebhookIssue `json:"issue"`
Comment WebhookComment `json:"comment"`
Repository WebhookRepository `json:"repository"`
Sender WebhookUser `json:"sender"`
}
type WebhookCommit struct {
ID string `json:"id"`
Message string `json:"message"`
Added []string `json:"added"`
Modified []string `json:"modified"`
}
// PushPayload is the body of a Forgejo "push" webhook event.
type PushPayload struct {
Ref string `json:"ref"`
After string `json:"after"`
Commits []WebhookCommit `json:"commits"`
Repository WebhookRepository `json:"repository"`
Pusher WebhookUser `json:"pusher"`
}