func (g *GitHub) DeleteDirectory(repo, msg string, dir interface{}, usr *User) error {
	opts := &github.RepositoryContentFileOptions{}
	opts.Committer = &github.CommitAuthor{Name: &usr.Name, Email: &usr.Mail}
	for _, file := range dir.([]*github.RepositoryContent) {
		fn := strings.TrimPrefix(*file.Path, "data_bags/")
		msg := fmt.Sprintf(msg, strings.TrimSuffix(fn, ".json"))
		opts.Message = &msg
		opts.SHA = file.SHA
		_, resp, err := g.client.Repositories.DeleteFile(context.TODO(), g.org, repo, *file.Path, opts)
		if err != nil {
			if resp != nil && resp.StatusCode == http.StatusUnauthorized {
				return fmt.Errorf(invalidGitHubToken, g.org)
			}
			return fmt.Errorf("Error deleting file %s: %v", *file.Path, err)
		}
	}
	return nil
}
DeleteDirectory implements the Git interface
package git
import (
	"bytes"
	"context"
	"fmt"
	"net/http"
	"net/url"
	"strings"
	"time"
	"github.com/google/go-github/github"
)
const (
	invalidGitHubToken = "The token configured for GitHub organization %s is not valid!"
)
func (g *GitHub) GetContent(repo, path string) (*File, interface{}, error) {
	file, dir, resp, err := g.client.Repositories.GetContents(context.TODO(), g.org, repo, path, nil)
	if err != nil {
		if resp != nil {
			switch resp.StatusCode {
			case http.StatusNotFound:
				return nil, nil, nil
			case http.StatusUnauthorized:
				return nil, nil, fmt.Errorf(invalidGitHubToken, g.org)
			}
		}
		return nil, nil, fmt.Errorf("Error retrieving file %s: %v", path, err)
	}
	if dir != nil {
		return nil, dir, nil
	}
	conf, err := file.GetContent()
	if err != nil {
		return nil, nil, fmt.Errorf("Error decoding file %s: %v", path, err)
	}
	f := &File{
		Content: conf,
		SHA:     *file.SHA,
	}
	return f, nil, nil
}
func (g *GitHub) CreateFile(repo, path, msg string, usr *User, content []byte) (string, error) {
	opts := &github.RepositoryContentFileOptions{}
	opts.Committer = &github.CommitAuthor{Name: &usr.Name, Email: &usr.Mail}
	opts.Content = content
	opts.Message = &msg
	r, resp, err := g.client.Repositories.CreateFile(context.TODO(), g.org, repo, path, opts)
	if err != nil {
		if resp != nil && resp.StatusCode == http.StatusUnauthorized {
			return "", fmt.Errorf(invalidGitHubToken, g.org)
		}
		return "", fmt.Errorf("Error creating file %s: %v", path, err)
	}
	return *r.SHA, nil
}
func (g *GitHub) UpdateFile(repo, path, sha, msg string, usr *User, content []byte) (string, error) {
	opts := &github.RepositoryContentFileOptions{}
	opts.Committer = &github.CommitAuthor{Name: &usr.Name, Email: &usr.Mail}
	opts.Content = content
	opts.Message = &msg
	opts.SHA = &sha
	r, resp, err := g.client.Repositories.UpdateFile(context.TODO(), g.org, repo, path, opts)
	if err != nil {
		if resp != nil && resp.StatusCode == http.StatusUnauthorized {
			return "", fmt.Errorf(invalidGitHubToken, g.org)
		}
		return "", fmt.Errorf("Error updating file %s: %v", path, err)
	}
	return *r.SHA, nil
}
func (g *GitHub) DeleteFile(repo, path, sha, msg string, usr *User) (string, error) {
	opts := &github.RepositoryContentFileOptions{}
	opts.Committer = &github.CommitAuthor{Name: &usr.Name, Email: &usr.Mail}
	opts.Message = &msg
	opts.SHA = &sha
	r, resp, err := g.client.Repositories.DeleteFile(context.TODO(), g.org, repo, path, opts)
	if err != nil {
		if resp != nil && resp.StatusCode == http.StatusUnauthorized {
			return "", fmt.Errorf(invalidGitHubToken, g.org)
		}
		return "", fmt.Errorf("Error deleting file %s: %v", path, err)
	}
	return *r.SHA, nil
}