Skip to content

Commit 76be887

Browse files
committed
Add Jira automation
1 parent 9ab5f34 commit 76be887

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/jira-sync.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
issues:
3+
types: [closed, deleted, reopened]
4+
pull_request_target:
5+
types: [closed, reopened]
6+
7+
name: Jira Sync
8+
9+
jobs:
10+
sync:
11+
runs-on: ubuntu-latest
12+
name: Jira sync
13+
steps:
14+
15+
- name: Login
16+
uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1
17+
if: contains(github.event.pull_request.labels.*.name, 'tf-devex-triage') || contains(github.event.issue.labels.*.name, 'tf-devex-triage')
18+
env:
19+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
20+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
21+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
22+
- name: Search for existing issue
23+
id: search
24+
if: contains(github.event.pull_request.labels.*.name, 'tf-devex-triage') || contains(github.event.issue.labels.*.name, 'tf-devex-triage')
25+
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2
26+
with:
27+
jql: 'project="TFECO" and "Team (R&D)[Labels]"="TF-DevEx" and description ~ "${{ github.event.issue.html_url || github.event.pull_request.html_url }}" and labels in (Github)'
28+
- name: Close task
29+
if: ( github.event.action == 'closed' || github.event.action == 'deleted' ) && steps.search.outputs.issue
30+
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3.0.0
31+
with:
32+
issue: ${{ steps.search.outputs.issue }}
33+
transition: "Closed"
34+
- name: Reopen task
35+
if: github.event.action == 'reopened' && steps.search.outputs.issue
36+
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3.0.0
37+
with:
38+
issue: ${{ steps.search.outputs.issue }}
39+
transition: "To Do"

.github/workflows/send-to-jira.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
issues:
3+
types: [labeled]
4+
5+
name: Jira Sync
6+
7+
jobs:
8+
sync:
9+
runs-on: ubuntu-latest
10+
name: Jira sync
11+
steps:
12+
13+
- name: Login
14+
uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1
15+
if: github.event.label.name == 'tf-devex-triage'
16+
env:
17+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
18+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
19+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
20+
- name: Search for existing issue
21+
id: search
22+
if: github.event.label.name == 'tf-devex-triage'
23+
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2
24+
with:
25+
jql: 'project="TFECO" and "Team (R&D)[Labels]"="TF-DevEx" and description ~ "${{ github.event.issue.html_url || github.event.pull_request.html_url }}" and labels in (Github)'
26+
27+
- name: Create task in DevEx board
28+
if: github.event.label.name == 'tf-devex-triage' && !steps.search.outputs.issue
29+
uses: atlassian/gajira-create@1ff0b6bd115a780592b47bfbb63fc4629132e6ec #v3
30+
with:
31+
project: TFECO
32+
issuetype: "Task"
33+
summary: "[GH] ${{ github.event.issue.title || github.event.pull_request.title }}"
34+
description: "${{ github.event.issue.html_url || github.event.pull_request.html_url }} \n Synced by Github Actions, tagged by ${{ github.actor }}"
35+
# customfield_10091 is Team (R&D)
36+
fields: '{"customfield_10091": ["TF-DevEx"], "labels": ["Github"]}'
37+

0 commit comments

Comments
 (0)