1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

Add workflow_job webhook (#33694)

Provide external Integration information about the Queue lossly based on
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=completed#workflow_job

Naming conflicts between GitHub & Gitea are here, Blocked => Waiting,
Waiting => Queued

Rationale Enhancement for ephemeral runners management #33570
This commit is contained in:
ChristopherHX
2025-03-11 18:40:38 +01:00
committed by GitHub
parent f61f30153b
commit 651ef66966
33 changed files with 520 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ type payloadConvertor[T any] interface {
Wiki(*api.WikiPayload) (T, error)
Package(*api.PackagePayload) (T, error)
Status(*api.CommitStatusPayload) (T, error)
WorkflowJob(*api.WorkflowJobPayload) (T, error)
}
func convertUnmarshalledJSON[T, P any](convert func(P) (T, error), data []byte) (t T, err error) {
@@ -80,6 +81,8 @@ func newPayload[T any](rc payloadConvertor[T], data []byte, event webhook_module
return convertUnmarshalledJSON(rc.Package, data)
case webhook_module.HookEventStatus:
return convertUnmarshalledJSON(rc.Status, data)
case webhook_module.HookEventWorkflowJob:
return convertUnmarshalledJSON(rc.WorkflowJob, data)
}
return t, fmt.Errorf("newPayload unsupported event: %s", event)
}