-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (47 loc) · 1.59 KB
/
update-jira-issue.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
name: Update Jira issue
on:
issues:
types:
- edited
permissions:
contents: write
issues: write
pull-requests: write
jobs:
update-issue:
name: Update Jira issue
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
- name: Extract Jira Issue Key
id: extract-key
run: |
TITLE="${{ github.event.issue.title }}"
JIRA_KEY=$(echo $TITLE | grep -o '\[ARV-[0-9]\+\]' | tr -d '[]')
echo "jira_key=${JIRA_KEY}" >> $GITHUB_OUTPUT
- name: Convert markdown to Jira Syntax
uses: peter-evans/jira2md@v1
id: md2jira
with:
input-text: |
### Github Issue Link
- ${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
mode: md2jira
- name: Update Jira Issue Comment
uses: atlassian/gajira-comment@v3
with:
issue: ${{ steps.extract-key.outputs.jira_key }}
comment: ${{ steps.md2jira.outputs.output-text }}
- name: Add comment about update
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: 'Jira Issue Updated: [${{ steps.extract-key.outputs.jira_key }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.extract-key.outputs.jira_key }})'