Skip to content

Commit e12b57b

Browse files
author
Pedro Angelo
committed
pr workflow to create jira ticket
1 parent 5364dab commit e12b57b

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

.github/workflows/issue_notify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# This workflows creates an jira issue for the respective configured account
1+
# This workflow is triggered by github issue and creates a jira ticket in the respective configured account
22
#
33
name: issue_notify
44
on:
55
issues:
66
types: [opened]
77
workflow_dispatch:
88
jobs:
9-
jira_login:
9+
jira_job:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Jira Login
@@ -19,7 +19,7 @@ jobs:
1919
id: jira_ticket
2020
uses: atlassian/gajira-create@v2.0.1
2121
with:
22-
project: GIT
22+
project: ${{secrets.JIRA_PROJECT_KEY}}
2323
issuetype: Bug
2424
summary: '[ns1-terraform] ${{github.event.issue.title}}'
25-
description: ${{github.event.issue.body}} see more ${{github.event.issue.html_url}}
25+
description: ${{github.event.issue.body}} see more at ${{github.event.issue.html_url}}

.github/workflows/pr_notify.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow is triggered by pull request and creates an jira ticket if the ticket does not exist in jira
2+
#
3+
name: pr_notify
4+
on:
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
jira_job:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Jira Login
12+
uses: atlassian/gajira-login@v2.0.0
13+
env:
14+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
15+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
16+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
17+
# try to find jira key in the PR title
18+
- name: Find jirakey in title
19+
id: jira_founded_ticket
20+
uses: atlassian/gajira-find-issue-key@master
21+
continue-on-error: true
22+
with:
23+
string: ${{ github.event.pull_request.title }}
24+
# if there is no ticket associated then create a new one
25+
- name: Jira Create issue
26+
id: jira_ticket
27+
if: ${{!steps.jira_founded_ticket.outputs.issue}}
28+
uses: atlassian/gajira-create@v2.0.1
29+
with:
30+
project: ${{secrets.JIRA_PROJECT_KEY}}
31+
issuetype: Task
32+
summary: ${{github.event.pull_request.title}}
33+
description: ${{github.event.pull_request.body}} see more at ${{github.event.pull_request.html_url}}

0 commit comments

Comments
 (0)