-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (84 loc) · 3.26 KB
/
pull_request.yml
File metadata and controls
87 lines (84 loc) · 3.26 KB
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
80
81
82
83
84
85
86
87
# name: slack
# # Controls when the workflow will run
# on:
# pull_request:
# branches: [ main ]
# jobs:
# slackNotification:
# name: Slack Notification
# runs-on: ubuntu-latest
# steps:
# - name: Jira Login
# uses: atlassian/gajira-login@v2.0.0
# env:
# JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
# JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
# #try to find jira key
# - name: Find in commit messages
# id: jira_founded_ticket
# uses: atlassian/gajira-find-issue-key@master
# continue-on-error: true
# with:
# string: ${{ github.event.pull_request.title }}
# - name: Jira Create issue
# id: jira_ticket
# if: ${{!steps.jira_founded_ticket.outputs.issue}}
# uses: atlassian/gajira-create@v2.0.1
# with:
# # Key of the project
# project: GIT
# # Type of the issue to be created. Example: 'Incident'
# issuetype: Task
# # Issue summary
# summary: ${{github.event.pull_request.title}}
# # Issue description
# description: ${{github.event.pull_request.body}} see more ${{github.event.pull_request.html_url}}
# - name: slack-send
# if: ${{!steps.jira_founded_ticket.outputs.issue}}
# uses: slackapi/slack-github-action@v1.15.0
# with:
# channel-id: ${{secrets.SLACK_CHANNEL_ID}}
# slack-message: 'New Pull request see more ${{secrets.JIRA_BASE_URL}}/browse/${{steps.jira_ticket.outputs.issue}}'
# env:
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
# - name: slack-send
# if: ${{steps.jira_founded_ticket.outputs.issue}}
# uses: slackapi/slack-github-action@v1.15.0
# with:
# channel-id: ${{secrets.SLACK_CHANNEL_ID}}
# slack-message: 'New Pull request see more ${{secrets.JIRA_BASE_URL}}/browse/${{steps.jira_founded_ticket.outputs.issue}}'
# env:
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
name: pr_notify
on:
pull_request:
branches: [main]
jobs:
jira_job:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Jira Login
uses: atlassian/gajira-login@v2.0.0
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
# try to find jira key in the PR title
- name: Find jirakey in title
id: jira_founded_ticket
uses: atlassian/gajira-find-issue-key@master
continue-on-error: true
with:
string: ${{ github.event.pull_request.title }}
# if there is no ticket associated then create a new one
- name: Jira Create issue
id: jira_ticket
if: ${{!steps.jira_founded_ticket.outputs.issue}}
uses: atlassian/gajira-create@v2.0.1
with:
project: ${{secrets.JIRA_PROJECT_KEY}}
issuetype: Task
summary: '[KEY NAME] ${{github.event.pull_request.title}}'
description: ${{github.event.pull_request.body}} see more at ${{github.event.pull_request.html_url}}