Documentation
¶
Overview ¶
webhook provides functionality to monitor GitHub webhook events and trigger grading of student submissions based on push events to the main branch.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubWebhookPayload ¶
type GitHubWebhookPayload struct { Ref string `json:"ref"` // Ref is the git reference (branch) that was pushed to. Repository struct { Name string `json:"name"` // Name is the name of the repository where the push occurred. } `json:"repository"` Pusher struct { Name string `json:"name"` // Name is the name of the user who pushed the commit. } `json:"pusher"` Commit struct { Message string `json:"message"` // Message is the commit message of the push. } `json:"head_commit"` }
GitHubWebhookPayload represents the structure of the JSON payload sent by GitHub when a push event occurs.
type WebhookTestMode ¶
type WebhookTestMode struct { MonitoringFunction func() // MonitoringFunction is the function that starts the webhook server. Modules map[string]Module.Module // Modules is a map of module names to their corresponding Module structs. CurrentModule string // CurrentModule is the name of the module currently being graded. // contains filtered or unexported fields }
WebhookTestMode represents the state and behavior for the webhook test mode, which triggers submission grading as soon as activity is recorded on a user's main branch.
func NewWebhookTestMode ¶
func NewWebhookTestMode(modules map[string]Module.Module, endpoint string, port string) *WebhookTestMode
NewWebhookTestMode initializes and returns a WebhookTestMode instance, which triggers submission grading as soon as activity is recorded on a user's main branch.
- modules: A map of module names to Module structs.
- endpoint: The endpoint the webhook is to be sending payloads to, with no trailing slash (e.g., '/webhook')
- port: The port the webhook is to be sending payloads to, without ':' (e.g., '8080')
Returns a pointer to the initialized WebhookTestMode.
func (*WebhookTestMode) Run ¶
func (wt *WebhookTestMode) Run(currentModule string)
Run starts the webhook server and sets the current module to be graded.
- currentModule: The name of the module that is currently being graded.