This repository has been archived by the owner on Jul 22, 2023. It is now read-only.
forked from github/ghas-jira-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
88 lines (88 loc) · 3.15 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 }}
github_app_id:
description: 'GitHub app ID'
required: false
github_install_id:
description: 'GitHub app install ID'
required: false
github_app_secret:
description: 'GitHub app private key'
required: false
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: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Run GitHub to Jira Sync
working-directory: ${{ github.action_path }}
shell: bash
env:
INPUTS_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUTS_GITHUB_APP_ID: ${{ inputs.github_app_id }}
INPUTS_GITHUB_INSTALL_ID: ${{ inputs.github_install_id }}
INPUTS_GITHUB_APP_SECRET: ${{ inputs.github_app_secret }}
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-app-id "$INPUTS_GITHUB_APP_ID" \
--gh-install-id "$INPUTS_GITHUB_INSTALL_ID" \
--gh-app-secret "$INPUTS_GITHUB_APP_SECRET" \
--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"