getFileContent loads the local content of a file and return the target name of the file in the target repository and its contents.
(fileArg string)
| 115 | // getFileContent loads the local content of a file and return the target name |
| 116 | // of the file in the target repository and its contents. |
| 117 | func getFileContent(fileArg string) (targetName string, b []byte, err error) { |
| 118 | var localFile string |
| 119 | files := strings.Split(fileArg, ":") |
| 120 | switch { |
| 121 | case len(files) < 1: |
| 122 | return "", nil, errors.New("empty `-files` parameter") |
| 123 | case len(files) == 1: |
| 124 | localFile = files[0] |
| 125 | targetName = files[0] |
| 126 | default: |
| 127 | localFile = files[0] |
| 128 | targetName = files[1] |
| 129 | } |
| 130 | |
| 131 | b, err = os.ReadFile(localFile) |
| 132 | return targetName, b, err |
| 133 | } |
| 134 | |
| 135 | // pushCommit creates the commit in the given reference using the given tree. |
| 136 | func pushCommit(ref *github.Reference, tree *github.Tree) (err error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…