@@ -2,12 +2,16 @@ name: "Mirror new issue to Jira for grooming"
2
2
3
3
on :
4
4
issues :
5
- types : [opened]
5
+ types : [opened, labeled ]
6
6
7
7
jobs :
8
8
create-issue :
9
9
runs-on : ubuntu-latest
10
10
11
+ if : >
12
+ github.event.action == 'opened' &&
13
+ !contains(github.event.issue.labels.*.name, 'tracked')
14
+
11
15
env :
12
16
JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
13
17
54
58
repo: context.repo.repo,
55
59
labels: ['tracked']
56
60
})
61
+
62
+ label-issue :
63
+ runs-on : ubuntu-latest
64
+
65
+ if : >
66
+ (github.event.issue.author_association == 'OWNER' ||
67
+ github.event.issue.author_association == 'COLLABORATOR' ||
68
+ github.event.issue.author_association == 'MEMBER') &&
69
+ github.event.action == 'labeled' &&
70
+ github.event.label.name == 'tracked'
71
+
72
+ env :
73
+ JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
74
+
75
+ steps :
76
+ - name : Installs Jira CLI
77
+ uses : atlassian/gajira-cli@master
78
+ with :
79
+ version : 1.0.23
80
+
81
+ - name : Writes Jira CLI configs
82
+ run : |
83
+ mkdir ~/.jira.d
84
+ cat <<EOM >~/.jira.d/config.yml
85
+ endpoint: ${{ secrets.JIRA_BASE_URL }}
86
+ user: ${{ secrets.JIRA_USER_EMAIL }}
87
+ authentication-method: api-token
88
+ EOM
89
+
90
+ - name : Create issue
91
+ run : |
92
+ jira create \
93
+ --noedit \
94
+ -p ${{ secrets.JIRA_PROJECT_CODE }} \
95
+ -i Task \
96
+ -o summary="${{ github.event.issue.title }}" \
97
+ -o description="${{ github.event.issue.body }}
98
+ ${{ github.event.issue.html_url }}" \
99
+ >> output
100
+
101
+ - name : Set label on Jira issue
102
+ run : |
103
+ jira labels add \
104
+ $(cat output | awk '{split($0,a," "); print a[2]}') \
105
+ grooming arduino-cli
0 commit comments