Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Use kalafut/m2j to convert markdown to Jira formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhjp committed Sep 7, 2020
1 parent 784c42a commit 4d89099
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/tomhjp/gh-action-jira-create
go 1.14

require (
github.com/kalafut/m2j v0.0.0-20200831013012-43edf17eb155
github.com/stretchr/testify v1.6.1
github.com/tomhjp/gh-action-jira v0.1.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/kalafut/m2j v0.0.0-20200831013012-43edf17eb155 h1:eZA4bGAG/36ygQeYyKtKEbuW5C3R80uvoMLQP6bsVvM=
github.com/kalafut/m2j v0.0.0-20200831013012-43edf17eb155/go.mod h1:1tGqsPGFpUsjWhUlxSWTVClcP0spd4hQpA/lRPiAHIc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"net/url"
"os"

"github.com/kalafut/m2j"

"github.com/tomhjp/gh-action-jira/config"
"github.com/tomhjp/gh-action-jira/jira"
)
Expand Down Expand Up @@ -105,7 +107,7 @@ func constructPayload(project, issueType, summary, description string, extraFiel
issueType,
},
"summary": summary,
"description": description,
"description": m2j.MDToJira(description),
},
}
for key, value := range extraFields {
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

func TestConstructPayload(t *testing.T) {
const expectedJSON = `{"fields":{"custom_field":[{"name":"foo"}],"description":"The description","foo":"bar","issuetype":{"name":"Bug"},"project":{"key":"FOO"},"summary":"The summary"}}`
reqBody, err := json.Marshal(constructPayload("FOO", "Bug", "The summary", "The description", map[string]interface{}{
const expectedJSON = `{"fields":{"custom_field":[{"name":"foo"}],"description":"The description with some {{code}}","foo":"bar","issuetype":{"name":"Bug"},"project":{"key":"FOO"},"summary":"The summary"}}`
reqBody, err := json.Marshal(constructPayload("FOO", "Bug", "The summary", "The description with some `code`", map[string]interface{}{
"foo": "bar",
"custom_field": []map[string]string{{"name": "foo"}},
}))
Expand Down

0 comments on commit 4d89099

Please sign in to comment.