-
Notifications
You must be signed in to change notification settings - Fork 91
69 lines (61 loc) · 2.61 KB
/
create-jira-tickets.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
60
61
62
63
64
65
66
67
68
69
name: Create JIRA tickets
on:
issues:
types: [opened, reopened]
pull_request:
types: [opened]
jobs:
create_ticket_from_issue:
name: Create JIRA ticket
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Set event vars
id: event
run: |
if [ ${{github.event.issue}} ]; then
echo "::set-output name=SUMMARY::GITHUB ISSUE #${{github.event.issue.number}} ${{github.event.issue.title}}"
echo "::set-output name=DESC::${{github.event.issue.html_url}} \n\n ${{github.event.issue.body}}"
echo "::set-output name=ISSUE_TYPE::Bug"
echo "::set-output name=LABEL::issue"
echo "::set-output name=USER::${{github.event.issue.user.login}}"
elif [ ${{github.event.pull_request}} ]; then
echo "::set-output name=SUMMARY::PR #${{github.event.pull_request.number}} ${{github.event.pull_request.title}}"
echo "::set-output name=DESC::${{github.event.pull_request.html_url}} \n\n ${{github.event.pull_request.body}}"
echo "::set-output name=ISSUE_TYPE::Task"
echo "::set-output name=LABEL::pr"
echo "::set-output name=USER::${{github.event.pull_request.user.login}}"
fi
- name: Debug event
run: |
echo "SUMMARY ${{steps.event.outputs.SUMMARY}}"
echo "DESC ${{steps.event.outputs.DESC}}"
- name: Create ticket
id: create
uses: atlassian/gajira-create@master
with:
project: LABS
issuetype: ${{steps.event.outputs.ISSUE_TYPE}}
summary: ${{steps.event.outputs.SUMMARY}}
description: ${{steps.event.outputs.DESC}}
fields: '{"labels": ["github", "${{steps.event.outputs.LABEL}}"], "customfield_10135": "fwitter"}'
- name: Set triage state
if: ${{ steps.create.outputs.issue }}
uses: atlassian/gajira-transition@master
with:
issue: ${{ steps.create.outputs.issue }}
transition: "TRIAGE"
- name: Create comment
if: ${{ github.event.issue }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{github.event.issue.number}}
body: Internal ticket number is ${{steps.create.outputs.issue}}
- name: Created issue
if: ${{ steps.create.outputs.issue }}
run: echo "Issue ${{ steps.create.outputs.issue }} was created"