File tree Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Original file line number Diff line number Diff line change
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}`);
Original file line number Diff line number Diff line change 119
119
"supportedVersions" : [
120
120
" 8" ,
121
121
" 11" ,
122
- " 17.0.12 " ,
123
- " 21 "
122
+ " 21 " ,
123
+ " 17 "
124
124
]
125
125
},
126
126
"javascript" : {
Original file line number Diff line number Diff line change 31
31
},
32
32
body: JSON.stringify({
33
33
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}`,
35
35
issuetype: {
36
36
id: '10001'
37
37
},
You can’t perform that action at this time.
0 commit comments