Merge pull request #72 from antonu17/fix/no-commit_sha-for-drafts
Skipping resolveTagToCommitSHA for drafts
This commit is contained in:
@@ -66,17 +66,19 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
|
||||
return InResponse{}, err
|
||||
}
|
||||
|
||||
commitPath := filepath.Join(destDir, "commit_sha")
|
||||
commitSHA, err = c.resolveTagToCommitSHA(*foundRelease.TagName)
|
||||
if err != nil {
|
||||
return InResponse{}, err
|
||||
}
|
||||
|
||||
if commitSHA != "" {
|
||||
err = ioutil.WriteFile(commitPath, []byte(commitSHA), 0644)
|
||||
if foundRelease.Draft != nil && !*foundRelease.Draft {
|
||||
commitPath := filepath.Join(destDir, "commit_sha")
|
||||
commitSHA, err = c.resolveTagToCommitSHA(*foundRelease.TagName)
|
||||
if err != nil {
|
||||
return InResponse{}, err
|
||||
}
|
||||
|
||||
if commitSHA != "" {
|
||||
err = ioutil.WriteFile(commitPath, []byte(commitSHA), 0644)
|
||||
if err != nil {
|
||||
return InResponse{}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if foundRelease.Body != nil && *foundRelease.Body != "" {
|
||||
|
@@ -464,7 +464,6 @@ var _ = Describe("In Command", func() {
|
||||
Context("which has a tag", func() {
|
||||
BeforeEach(func() {
|
||||
githubClient.GetReleaseReturns(buildRelease(1, "v0.35.0", true), nil)
|
||||
githubClient.GetRefReturns(buildTagRef("v0.35.0", "f28085a4a8f744da83411f5e09fd7b1709149eee"), nil)
|
||||
|
||||
inRequest.Version = &resource.Version{ID: "1"}
|
||||
inResponse, inErr = command.Run(destDir, inRequest)
|
||||
@@ -484,7 +483,6 @@ var _ = Describe("In Command", func() {
|
||||
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
|
||||
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
|
||||
resource.MetadataPair{Name: "tag", Value: "v0.35.0"},
|
||||
resource.MetadataPair{Name: "commit_sha", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"},
|
||||
resource.MetadataPair{Name: "draft", Value: "true"},
|
||||
))
|
||||
})
|
||||
@@ -497,10 +495,6 @@ var _ = Describe("In Command", func() {
|
||||
contents, err = ioutil.ReadFile(path.Join(destDir, "version"))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(string(contents)).Should(Equal("0.35.0"))
|
||||
|
||||
contents, err = ioutil.ReadFile(path.Join(destDir, "commit_sha"))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(string(contents)).Should(Equal("f28085a4a8f744da83411f5e09fd7b1709149eee"))
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user