Skip to content

Commit 1490456

Browse files
authored
Merge 33c2d92 into 46f4c4b
2 parents 46f4c4b + 33c2d92 commit 1490456

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

.github/workflows/issue.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Issue sync with Jira'
2+
on:
3+
issues:
4+
types: [opened]
5+
6+
permissions:
7+
issues: write
8+
contents: read
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Create ticket
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
const action = context.payload.action;
19+
if (action !== 'opened') {
20+
return;
21+
}
22+
const title = context.payload.issue.title;
23+
const body = context.payload.issue.body;
24+
25+
const res = await fetch('https://algolia.atlassian.net/rest/api/2/issue', {
26+
method: 'POST',
27+
headers: {
28+
'Accept': 'application/json',
29+
'Content-Type': 'application/json',
30+
'Authorization': `Basic ${{ secrets.JIRA_TOKEN }}`
31+
},
32+
body: JSON.stringify({
33+
fields: {
34+
description: `Issue created by ${context.actor} at ${context.payload.issue.html_url} \n\n${body}`,
35+
issuetype: {
36+
id: '10001'
37+
},
38+
parent: {
39+
key: 'DI-2737'
40+
},
41+
project: {
42+
id: '10118'
43+
},
44+
summary: `[GH-ISSUE] ${title}`
45+
},
46+
update: {}
47+
})
48+
});
49+
50+
if (!res.ok) {
51+
throw new Error(`Failed to create ticket: ${res.statusText} (${res.status}) - ${await res.text()}`);
52+
}
53+
54+
const data = await res.json();
55+
console.log(`Created ticket: ${data.key}`);

config/clients.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@
119119
"supportedVersions": [
120120
"8",
121121
"11",
122-
"17.0.12",
123-
"21"
122+
"21",
123+
"17"
124124
]
125125
},
126126
"javascript": {

templates/issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
},
3232
body: JSON.stringify({
3333
fields: {
34-
description: `Issue created by ${context.actor} at [${context.payload.issue.html_url}](${context.payload.issue.html_url}) \n\n${body}`,
34+
description: `Issue created by ${context.actor} at ${context.payload.issue.html_url} \n\n${body}`,
3535
issuetype: {
3636
id: '10001'
3737
},

0 commit comments

Comments
 (0)