Rename generated file back to commit_sha

This commit is contained in:
Christoph Sassenberg
2018-01-14 10:19:47 +01:00
parent 4da19b53b4
commit 7bff836cc2
4 changed files with 8 additions and 8 deletions

View File

@@ -92,7 +92,7 @@ Also creates the following files:
* `tag` containing the git tag name of the release being fetched. * `tag` containing the git tag name of the release being fetched.
* `version` containing the version determined by the git tag of the release being fetched. * `version` containing the version determined by the git tag of the release being fetched.
* `body` containing the body text of the release. * `body` containing the body text of the release.
* `target_commit` containing the commit SHA the tag is pointing to. * `commit_sha` containing the commit SHA the tag is pointing to.
#### Parameters #### Parameters

View File

@@ -62,7 +62,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
return InResponse{}, err return InResponse{}, err
} }
commitPath := filepath.Join(destDir, "target_commit") commitPath := filepath.Join(destDir, "commit_sha")
commitSHA = c.resolveTagToCommitSHA(*foundRelease.TagName) commitSHA = c.resolveTagToCommitSHA(*foundRelease.TagName)
err = ioutil.WriteFile(commitPath, []byte(commitSHA), 0644) err = ioutil.WriteFile(commitPath, []byte(commitSHA), 0644)
if err != nil { if err != nil {

View File

@@ -142,7 +142,7 @@ var _ = Describe("In Command", func() {
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"}, resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true}, resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
resource.MetadataPair{Name: "tag", Value: "v0.35.0"}, resource.MetadataPair{Name: "tag", Value: "v0.35.0"},
resource.MetadataPair{Name: "target_commit", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"}, resource.MetadataPair{Name: "commit_sha", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"},
)) ))
}) })
@@ -171,7 +171,7 @@ var _ = Describe("In Command", func() {
Ω(err).ShouldNot(HaveOccurred()) Ω(err).ShouldNot(HaveOccurred())
Ω(string(contents)).Should(Equal("0.35.0")) Ω(string(contents)).Should(Equal("0.35.0"))
contents, err = ioutil.ReadFile(path.Join(destDir, "target_commit")) contents, err = ioutil.ReadFile(path.Join(destDir, "commit_sha"))
Ω(err).ShouldNot(HaveOccurred()) Ω(err).ShouldNot(HaveOccurred())
Ω(string(contents)).Should(Equal("f28085a4a8f744da83411f5e09fd7b1709149eee")) Ω(string(contents)).Should(Equal("f28085a4a8f744da83411f5e09fd7b1709149eee"))
@@ -361,7 +361,7 @@ var _ = Describe("In Command", func() {
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"}, resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true}, resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
resource.MetadataPair{Name: "tag", Value: "v0.35.0"}, resource.MetadataPair{Name: "tag", Value: "v0.35.0"},
resource.MetadataPair{Name: "target_commit", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"}, resource.MetadataPair{Name: "commit_sha", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"},
)) ))
}) })
@@ -455,7 +455,7 @@ var _ = Describe("In Command", func() {
resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"}, resource.MetadataPair{Name: "name", Value: "release-name", URL: "http://google.com"},
resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true}, resource.MetadataPair{Name: "body", Value: "*markdown*", Markdown: true},
resource.MetadataPair{Name: "tag", Value: "v0.35.0"}, resource.MetadataPair{Name: "tag", Value: "v0.35.0"},
resource.MetadataPair{Name: "target_commit", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"}, resource.MetadataPair{Name: "commit_sha", Value: "f28085a4a8f744da83411f5e09fd7b1709149eee"},
resource.MetadataPair{Name: "draft", Value: "true"}, resource.MetadataPair{Name: "draft", Value: "true"},
)) ))
}) })
@@ -500,7 +500,7 @@ var _ = Describe("In Command", func() {
It("does not create the tag and version files", func() { It("does not create the tag and version files", func() {
Ω(path.Join(destDir, "tag")).ShouldNot(BeAnExistingFile()) Ω(path.Join(destDir, "tag")).ShouldNot(BeAnExistingFile())
Ω(path.Join(destDir, "version")).ShouldNot(BeAnExistingFile()) Ω(path.Join(destDir, "version")).ShouldNot(BeAnExistingFile())
Ω(path.Join(destDir, "target_commit")).ShouldNot(BeAnExistingFile()) Ω(path.Join(destDir, "commit_sha")).ShouldNot(BeAnExistingFile())
}) })
}) })

View File

@@ -42,7 +42,7 @@ func metadataFromRelease(release *github.RepositoryRelease, commitSHA string) []
if commitSHA != "" { if commitSHA != "" {
metadata = append(metadata, MetadataPair{ metadata = append(metadata, MetadataPair{
Name: "target_commit", Name: "commit_sha",
Value: commitSHA, Value: commitSHA,
}) })
} }