Implement filter that handles conclusions other than 'success'

This commit is contained in:
Rickard Granberg 2024-06-08 13:11:07 +00:00
parent d4e0c835b0
commit f74dfc1ab5
1 changed files with 2 additions and 1 deletions

View File

@ -217,7 +217,8 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons
// But canceled events have runner_id == 0 and GetRunnerID() returns 0 when RunnerID == nil,
// so we need to be more specific in filtering out the check runs.
// See example check run completion at https://gist.github.com/nathanklick/268fea6496a4d7b14cecb2999747ef84
if e.GetWorkflowJob().GetConclusion() == "success" && e.GetWorkflowJob().RunnerID == nil {
// Check runs appear to have no labels set, so use that in conjuction with the nil RunnerID to filter the event:
if len(e.GetWorkflowJob().Labels) == 0 && e.GetWorkflowJob().RunnerID == nil {
log.V(1).Info("Ignoring workflow_job event because it does not relate to a self-hosted runner")
} else {
// A negative amount is processed in the tryScale func as a scale-down request,