-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (48 loc) · 1.89 KB
/
reusable-create-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
on:
workflow_call:
secrets:
JIRA_BASE_URL:
required: true
JIRA_USER_EMAIL:
required: true
JIRA_API_TOKEN:
required: true
JIRA_PROJECT:
required: true
JIRA_FIELDS:
required: true
jobs:
create-jira-issue:
if: ${{ startsWith(github.event.label.name, 'Jira') }}
runs-on: ubuntu-latest
steps:
- name: Get Jira issue type
id: get_jira_issue_type
run: |
type=$(echo '${{ github.event.label.name }}' | cut -d' ' -f2)
echo "type=$type" >> "$GITHUB_OUTPUT"
- name: Login to Jira
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: Create Jira issue
id: create_jira_issue
uses: atlassian/gajira-create@v3
with:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: ${{ steps.get_jira_issue_type.outputs.type }}
summary: ${{ github.event.issue.title }}
description: ${{ github.event.issue.html_url }}
fields: '${{ secrets.JIRA_FIELDS }}'
- name: Add Jira issue key to GitHub issue body
uses: actions-cool/issues-helper@v3
with:
actions: update-issue
body: "<!-- WARNING: The following lines were added by create-jira-issue, please do not modify! -->\n\
**Jira:** ${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create_jira_issue.outputs.issue }}\n\n\
*Note: The above link is accessible only to members of ASF.*\n\n\
----------------------------------------------------------------------------------------------------\n\
<!-- WARNING: The preceding lines were added by create-jira-issue, please do not modify! -->\n\n\
${{ github.event.issue.body }}"