forked from github/ghas-jira-integration
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
69 lines (69 loc) · 2.5 KB
/
action.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: 'Sync GitHub Advanced Security and Jira'
description: "This helps sync GHAS alerts to JIRA by creating an
issue for each alert."
inputs:
jira_url:
description: 'URL of the JIRA instance'
required: true
jira_user:
description: 'JIRA account with the required permissions'
required: true
jira_token:
description: 'JIRA password or token'
required: true
jira_project:
description: 'JIRA project key'
required: true
jira_labels:
description: 'JIRA bug label(s). (e.g. valid format can be "red-team,blue-team,green-team", or "red-team")
This tool will split the values entered by commas. Spaces in the double quotes
will be respected and saved.'
required: false
github_token:
description: 'GitHub API token with the required permissions'
required: false
default: ${{ github.token }}
sync_direction:
description: 'Which direction to synchronize in ("gh2jira", "jira2gh" or "both")'
required: false
default: 'both'
issue_end_state:
description: 'Custom end state'
required: false
default: 'Done'
issue_reopen_state:
description: 'Custom reopen state'
required: false
default: 'To Do'
runs:
using: composite
steps:
- name: Run GitHub to Jira Sync
working-directory: ${{ github.action_path }}
shell: bash
env:
INPUTS_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUTS_JIRA_URL: ${{ inputs.jira_url }}
INPUTS_JIRA_USER: ${{ inputs.jira_user }}
INPUTS_JIRA_TOKEN: ${{ inputs.jira_token }}
INPUTS_JIRA_PROJECT: ${{ inputs.jira_project }}
INPUTS_JIRA_LABELS: ${{ inputs.jira_labels }}
INPUTS_SYNC_DIRECTION: ${{ inputs.sync_direction }}
INPUTS_ISSUE_END_STATE: ${{ inputs.issue_end_state }}
INPUTS_ISSUE_REOPEN_STATE: ${{ inputs.issue_reopen_state }}
run: |
pip3 install -r requirements.txt
REPOSITORY_NAME="$(echo "$GITHUB_REPOSITORY" | cut -d/ -f 2)"
./gh2jira sync \
--gh-url "$GITHUB_API_URL" \
--gh-token "$INPUTS_GITHUB_TOKEN" \
--gh-org "$GITHUB_REPOSITORY_OWNER" \
--gh-repo "$REPOSITORY_NAME" \
--jira-url "$INPUTS_JIRA_URL" \
--jira-user "$INPUTS_JIRA_USER" \
--jira-token "$INPUTS_JIRA_TOKEN" \
--jira-project "$INPUTS_JIRA_PROJECT" \
--jira-labels "$INPUTS_JIRA_LABELS" \
--direction "$INPUTS_SYNC_DIRECTION" \
--issue-end-state "$INPUTS_ISSUE_END_STATE" \
--issue-reopen-state "$INPUTS_ISSUE_REOPEN_STATE"