@@ -111,6 +111,7 @@ func run() {
111
111
imapServerPort := os .Getenv ("IMAP_PORT" )
112
112
imapUser := os .Getenv ("IMAP_USER" )
113
113
imapPassword := os .Getenv ("IMAP_PASSWORD" )
114
+ jiraApiVersion := os .Getenv ("JIRA_API_VERSION" )
114
115
115
116
// Connect to server
116
117
c , err := client .DialTLS (imapServer + ":" + imapServerPort , nil )
@@ -199,12 +200,12 @@ func run() {
199
200
200
201
issueNumber := subject [strings .LastIndex (subject , "[" )+ 1 : strings .LastIndex (subject , "]" )]
201
202
202
- resp := makeGetRequest ("/rest/api/3 /issue/" + issueNumber )
203
+ resp := makeGetRequest ("/rest/api/" + jiraApiVersion + " /issue/" + issueNumber )
203
204
204
205
if resp .StatusCode != 200 {
205
206
printErrorFromApi (resp )
206
207
} else {
207
- resp := makePostRequest ("/rest/api/3 /issue/" + issueNumber + "/comment" , jsonString )
208
+ resp := makePostRequest ("/rest/api/" + jiraApiVersion + " /issue/"+ issueNumber + "/comment" , jsonString )
208
209
209
210
if resp .StatusCode != 201 {
210
211
printErrorFromApi (resp )
@@ -225,7 +226,9 @@ func run() {
225
226
jsonString = strings .Replace (jsonString , "%SUMMARY%" , subject , 1 )
226
227
jsonString = strings .Replace (jsonString , "%DESCRIPTION%" , strings .TrimSpace (sanitizedBody ), 1 )
227
228
228
- resp := makePostRequest ("/rest/api/3/issue" , jsonString )
229
+ log .Println (jsonString )
230
+
231
+ resp := makePostRequest ("/rest/api/" + jiraApiVersion + "/issue" , jsonString )
229
232
230
233
if resp .StatusCode != 201 {
231
234
printErrorFromApi (resp )
0 commit comments