|
|
@@ -415,28 +415,28 @@ func (g *GithubActions) deleteGithubFile(
|
|
|
client *github.Client,
|
|
|
filename string,
|
|
|
) error {
|
|
|
- filepath := ".github/workflows/" + filename
|
|
|
- sha := ""
|
|
|
+ branch := g.GitBranch
|
|
|
+ if branch == "" {
|
|
|
+ branch = g.defaultBranch
|
|
|
+ }
|
|
|
|
|
|
+ filepath := ".github/workflows/" + filename
|
|
|
// get contents of a file if it exists
|
|
|
fileData, _, _, _ := client.Repositories.GetContents(
|
|
|
context.TODO(),
|
|
|
g.GitRepoOwner,
|
|
|
g.GitRepoName,
|
|
|
filepath,
|
|
|
- &github.RepositoryContentGetOptions{},
|
|
|
+ &github.RepositoryContentGetOptions{
|
|
|
+ Ref: branch,
|
|
|
+ },
|
|
|
)
|
|
|
|
|
|
+ sha := ""
|
|
|
if fileData != nil {
|
|
|
sha = *fileData.SHA
|
|
|
}
|
|
|
|
|
|
- branch := g.GitBranch
|
|
|
-
|
|
|
- if branch == "" {
|
|
|
- branch = g.defaultBranch
|
|
|
- }
|
|
|
-
|
|
|
opts := &github.RepositoryContentFileOptions{
|
|
|
Message: github.String(fmt.Sprintf("Delete %s file", filename)),
|
|
|
Branch: &branch,
|