func (w *workerQueue) runJobRequest(j *jobRequest, gist *github.Gist, status *github.RepoStatus, blame []string) {
	w.mu.Lock()
	defer w.mu.Unlock()
	log.Printf("- Running test for %s at %s", j.getID(), j.commitHash)
	failed := w.runJobRequestInner(j, gist, status)
	if failed && len(blame) != 0 {
		title := fmt.Sprintf("Build %q failed on %s", w.name, j.commitHash)
		log.Printf("- Failed: %s", title)
		log.Printf("- Blame: %v", blame)
	}
	log.Printf("- testing done: https://github.com/%s/commit/%s", j.getID(), j.commitHash[:12])
}
runJobRequest runs the check for the repository hosted on github at the
specified commit.

It will use the ssh protocol if "useSSH" is set, https otherwise.
"status" is the github status to keep updating as progress is made.

TODO(maruel): If "blame" is not empty, an issue is created on failure.
package main
import (
	"context"
	"fmt"
	"log"
	"strings"
	"sync"
	"time"
	"github.com/google/go-github/v31/github"
	"golang.org/x/oauth2"
	"periph.io/x/gohci"
)
type worker interface {
	enqueueCheck(org, repo, altpath, commitHash string, useSSH bool, pullID int, blame []string)
	wait()
}
type workerQueue struct {
	name   string  
	ctx    context.Context
	client *github.Client  
	wd     string
	mu sync.Mutex      
	wg sync.WaitGroup  
}
func newWorkerQueue(name, wd string, accessToken string) worker {
	tc := oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(&oauth2.Token{AccessToken: accessToken}))
	return &workerQueue{
		name:   name,
		ctx:    context.Background(),
		client: github.NewClient(tc),
		wd:     wd,
	}
}
func (w *workerQueue) enqueueCheck(org, repo, altpath, commitHash string, useSSH bool, pullID int, blame []string) {
	w.wg.Add(1)
	defer w.wg.Done()
	j := newJobRequest(org, repo, altpath, commitHash, useSSH, pullID, w.wd)
	if commitHash == "" && !j.findCommitHash() {
		log.Printf("- failed to get HEAD for issue #%d", pullID)
		return
	}
	log.Printf("- Enqueuing test for %s at %s", j.getID(), j.commitHash)
	gist := &github.Gist{
		Description: github.String(fmt.Sprintf("%s for %s", w.name, j)),
		Public: github.Bool(false),
		Files: map[github.GistFilename]github.GistFile{
			"setup-0-metadata": {Content: github.String(j.metadata())},
		},
	}
	gist, _, err := w.client.Gists.Create(w.ctx, gist)
	if err != nil {
		log.Printf("- Failed to create gist: %v", err)
		return
	}
	log.Printf("- Gist at %s", *gist.HTMLURL)
	status := &github.RepoStatus{
		State:       github.String("pending"),
		Description: github.String("Checks pending"),
		Context:     &w.name,
		TargetURL: gist.HTMLURL,
	}
	if !w.status(j, status) {
		return
	}
	w.wg.Add(1)
	go func() {
		defer w.wg.Done()
		w.runJobRequest(j, gist, status, blame)
	}()
}
func (w *workerQueue) wait() {
	w.wg.Wait()
}