-
-
Notifications
You must be signed in to change notification settings - Fork 479
59 lines (50 loc) · 1.98 KB
/
issue-comment-created.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Issue Comment Created
on:
issue_comment:
types:
- created
jobs:
jira:
runs-on: ubuntu-latest
if: ${{ github.event.comment.body == '/jira ticket' }}
steps:
- run: echo ${{ github.event.comment.body }}
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: SearchParam
run: echo 'summary ~ ${{ toJSON(github.event.issue.title)}} AND project=${{ secrets.JIRA_PROJECT }}'
- name: Search
id: search
uses: tomhjp/[email protected]
with:
jql: 'summary ~ ${{ toJSON(github.event.issue.title)}} AND project=${{ secrets.JIRA_PROJECT }}'
- name: Log
run: echo "Found issue ${{ steps.search.outputs.issue }}"
- name: Create
id: create
if: steps.search.outputs.issue == ''
uses: atlassian/gajira-create@v3
with:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: Task
summary: '${{ github.event.repository.name }}: ${{ github.event.issue.title }}'
description: |
*Issue Link:* ${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
fields: '{"customfield_10006": ${{ toJSON(secrets.JIRA_EPIC_TICKET) }}, "customfield_17401":{"value":${{ toJSON( secrets.JIRA_LAYER_CAKE )}}}}'
- name: Add Comment
if: steps.search.outputs.issue == '' && steps.create.outputs.issue != ''
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thanks, Jira [${{steps.create.outputs.issue}}] ticket created.'
})