Skip to content

Commit 085f994

Browse files
authored
Add files via upload
1 parent a783129 commit 085f994

File tree

2 files changed

+78
-11
lines changed

2 files changed

+78
-11
lines changed

.github/workflows/jira-issue-transfer.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ name: Jira Issue Transfer
1717

1818
on:
1919
issues:
20-
types:
21-
- opened
20+
types:
21+
- labeled
2222
jobs:
2323
build:
2424
runs-on: self-hosted
@@ -29,13 +29,25 @@ jobs:
2929
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
3030
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
3131
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
32-
- name: Jira Create
33-
uses: atlassian/gajira-create@v3
34-
with:
35-
project: BP
36-
issuetype: 'Bug Report'
37-
summary: ${{ github.event.issue.title }}
38-
description: "Github Issue Link: ${{ github.event.issue.url}} \r\n ${{ github.event.issue.body }}"
39-
fields: '{"labels":["GitHubReport"]}'
40-
env:
4132
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
if: github.event.label.name == 'ticketed' && !contains(github.event.issue.labels.*.name, 'ticketed')
34+
if: contains(github.event.issue.labels.*.name, 'bug')
35+
- name: Jira Create
36+
uses: atlassian/gajira-create@v3
37+
with:
38+
project: BP
39+
issuetype: 'Bug Report'
40+
summary: ${{ github.event.issue.title }}
41+
description: "Github Issue Link: ${{ github.event.issue.html_url}} \r\n ${{ github.event.issue.body }}"
42+
fields: '{"labels":["GitHubReport"]}'
43+
44+
if: contains(github.event.issue.labels.*.name, 'enhancement')
45+
- name: Jira Create
46+
uses: atlassian/gajira-create@v3
47+
with:
48+
project: BP
49+
issuetype: 'Product Feature'
50+
summary: ${{ github.event.issue.title }}
51+
description: "Github Issue Link: ${{ github.event.issue.html_url}} \r\n ${{ github.event.issue.body }}"
52+
fields: '{"labels":["GitHubReport"]}'
53+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2023 Specter Ops, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
name: PR-Ticket-OoOrg
17+
18+
on:
19+
pull_request:
20+
types: [opened, synchronize]
21+
22+
jobs:
23+
build:
24+
runs-on: self-hosted
25+
steps:
26+
- name: Check if PR is from within the organization
27+
id: check_org
28+
run:
29+
PR_URL=$(jq -r .pull_request.url "$GITHUB_EVENT_PATH")
30+
PR_NUMBER=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH")
31+
TEAM_SLUG="bloodhound-engineering" # Replace with your team's slug
32+
GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
33+
PR_ORG=$(jq -r .pull_request.head.repo.organization.login "$GITHUB_EVENT_PATH")
34+
PR_USER=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH")
35+
TEAM_MEMBERSHIP=$(curl -s -X GET -H "Authorization: token $GITHUB_TOKEN" \
36+
"https://api.github.com/orgs/$PR_ORG/teams/$TEAM_SLUG/memberships/$PR_USER")
37+
38+
env:
39+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
40+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
41+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
if [ -z "$TEAM_MEMBERSHIP" ]; then
45+
- name: Login
46+
uses: atlassian/gajira-login@v3
47+
- name: Jira Create
48+
uses: atlassian/gajira-create@v3
49+
with:
50+
project: BP
51+
issuetype: 'Product Feature'
52+
summary: ${{ github.event.pulls.title }}
53+
description: "Github Pull Request Link: ${{ github.event.pulls.html_url}} \r\n ${{ github.event.pulls.body }}"
54+
fields: '{"labels":["GitHubReport"]}'
55+

0 commit comments

Comments
 (0)