-
Notifications
You must be signed in to change notification settings - Fork 36
79 lines (71 loc) · 2.46 KB
/
jira.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
70
71
72
73
74
75
76
77
78
79
name: Create Jira Issue
on:
issues:
types:
- labeled
jobs:
check-existing-jira-issue:
name: Check for an existing linked Jira issue
runs-on: ubuntu-latest
if: github.event.label.name == 'Jira'
outputs:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
steps:
- name: Find Existing Linked Ticket
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.issue.number }}
body-regex: '^https:\/\/eliterate\.atlassian\.net\/browse\/MER-\d+$'
create-jira-issue:
name: Create new Jira issue
runs-on: ubuntu-latest
needs: check-existing-jira-issue
if: needs.check-existing-jira-issue.outputs.comment-id == ''
permissions:
issues: write
steps:
- 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: Get higest priority label
id: priority
run: |
echo "Determining priority from issue labels: ${{ github.event.issue.labels.*.name }}"
if ${{ contains(github.event.issue.labels.*.name, 'Priority 1: Critical') }}; then
PRIORITY="Highest"
elif ${{ contains(github.event.issue.labels.*.name, 'Priority 2: High') }}; then
PRIORITY="High"
elif ${{ contains(github.event.issue.labels.*.name, 'Priority 3: Normal') }}; then
PRIORITY="Medium"
else
PRIORITY="Medium"
fi
echo "priority=$PRIORITY" >> $GITHUB_OUTPUT
- name: Create
id: create
uses: atlassian/gajira-create@v3
with:
project: MER
issuetype: Bug
summary: "${{ github.event.issue.title }}"
description: |
${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
fields: |
{
"priority": {
"name": "${{ steps.priority.outputs.priority }}"
}
}
- name: Log created issue
run: echo "Issue ${{ steps.create.outputs.issue }} was created"
- name: Add comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
https://eliterate.atlassian.net/browse/${{ steps.create.outputs.issue }}