import ( "k8s.io/contrib/mungegithub/github" ) client := github.NewClient(token) owner := "myusername" repo := "myrepository" path := "myfile.txt" fileContent, err := github.MungeObject(client, owner, repo, path, "master") if err != nil { // Handle error }
import ( "k8s.io/contrib/mungegithub/github" "encoding/base64" ) client := github.NewClient(token) owner := "myusername" repo := "myrepository" path := "myfile.txt" branch := "master" newContent := "New content for my file" newContentBytes := []byte(newContent) newContentEncoded := base64.StdEncoding.EncodeToString(newContentBytes) fileContent, err := github.MungeObject(client, owner, repo, path, branch) if err != nil { // Handle error } sha := fileContent.Sha updateResponse, err := github.MungeObjectUpdate( client, owner, repo, path, branch, sha, newContentEncoded, "Update my file", ) if err != nil { // Handle error }
import ( "k8s.io/contrib/mungegithub/github" ) client := github.NewClient(token) owner := "myusername" repo := "myrepository" pullRequestNumber := 1 comment := "This is my comment" _, _, err := github.WriteComment( client, owner, repo, pullRequestNumber, comment, ) if err != nil { // Handle error }