func findGitlabCiFile(directory string) (string, error) {
	candidate := path.Join(directory, gitlabCiFileName)
	fileInfo, err := os.Stat(candidate)
	if !os.IsNotExist(err) && !fileInfo.IsDir() {
		return candidate, nil
	}
	if directory[len(directory)-1] == filepath.Separator {
		return "", errors.New("not found")
	}
	return findGitlabCiFile(filepath.Dir(directory))
}
Search in the given directory a git repository directory
It goes up in the filesystem hierarchy until a repository is found, or the root is reach
package main
import (
	"encoding/json"
	"errors"
	"fmt"
	"gitlab.com/orobardet/gitlab-ci-linter/config"
	"io/ioutil"
	"net"
	"net/http"
	"os"
	"path"
	"path/filepath"
	"strings"
	"time"
)
const gitlabCiFileName = ".gitlab-ci.yml"
const defaultGitlabRootURL = "https://gitlab.com"
const gitlabAPICiLintPath = "/api/v4/ci/lint"
type GitlabAPILintRequest struct {
	Content string `json:"content"`
}
type GitlabAPILintResponse struct {
	Status     string   `json:"status,omitempty"`
	Error      string   `json:"error,omitempty"`
	Errors     []string `json:"errors,omitempty"`
	MergedYaml string   `json:"merged_yaml,omitempty"`
}