@@ -2,12 +2,16 @@ name: "Mirror new issue to Jira for grooming"
22
33on :
44 issues :
5- types : [opened]
5+ types : [opened, labeled ]
66
77jobs :
88 create-issue :
99 runs-on : ubuntu-latest
1010
11+ if : >
12+ github.event.action == 'opened' &&
13+ !contains(github.event.issue.labels.*.name, 'tracked')
14+
1115 env :
1216 JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
1317
5458 repo: context.repo.repo,
5559 labels: ['tracked']
5660 })
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