-
Notifications
You must be signed in to change notification settings - Fork 10
63 lines (54 loc) · 1.93 KB
/
issue-comment-from-jira.yml
File metadata and controls
63 lines (54 loc) · 1.93 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
# This is a workflow add a comment on a GitHub issue
name: Add Github Comment
# Controls when the workflow will run
on:
workflow_dispatch:
inputs:
jira_ticket:
type: string
description: Jira ticket number
required: true
comment:
type: string
description: Jira ticket status
required: true
repository_dispatch:
jobs:
add-issue-comment:
runs-on: ubuntu-latest
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
steps:
- name: Login
uses: atlassian/gajira-login@master
- name: Get Jira Ticket Links
uses: fjogeleit/http-request-action@v1.16.5
id: get_links
with:
url: ${{ env.JIRA_BASE_URL }}/rest/api/2/issue/${{ github.event.inputs.jira_ticket }}/remotelink
method: GET
username: ${{ env.JIRA_USER_EMAIL }}
password: ${{ env.JIRA_API_TOKEN }}
customHeaders: '{"Content-Type": "application/json"}'
- run: echo ${{ steps.get_links.outputs.response }}
- name: Parse URL from List
id: parse_url
run: |
echo issue_url=`echo '${{ steps.get_links.outputs.response }}' | jq '.[]|select(.object.title | startswith("Github Issue Link:")).object.url'`
- uses: mad9000/actions-find-and-replace-string@2
id: sub
with:
source: '${{ steps.parse_url.outputs.issue_url }}'
find: github.com
replace: api.github.com/repos
- run: echo ${{ steps.sub.outputs.value }}
- name: Add Comment
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.MP_SEMANTIC_RELEASE_BOT}}" \
${{ steps.sub.outputs.value }}/comments \
-d '{"body":"${{ github.event.inputs.comment }}"}'