-
Notifications
You must be signed in to change notification settings - Fork 160
54 lines (49 loc) · 2.2 KB
/
jira-pr-transition.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
name: Jira Issue PR Transition
on:
# workflow_call is used so that this workflow may be re-used in other repositories.
#
# Trigger on these pull_request or pull_request_target events:
# [opened, closed, reopened, converted_to_draft, ready_for_review]
#
# (see call-jira-pr-transition for example)
workflow_call:
jobs:
pr-transition:
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c # v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Find in branch name
id: search
uses: atlassian/gajira-find-issue-key@7d9cbdfce900a0fcf608050ce728620a928be8b6 # v3
with:
string: ${{ github.head_ref }}
from: ""
- name: Debug
run: |
echo " Issue: ${{ steps.search.outputs.issue }}"
echo "Action: ${{ github.event.action }}"
echo "Merged: ${{ github.event.pull_request.merged }}"
echo " Draft: ${{ github.event.pull_request.draft }}"
- name: Transition Drafts to In Progress
if: steps.search.outputs.issue && github.event.pull_request.draft
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3
with:
issue: ${{ steps.search.outputs.issue }}
transition: "In Progress"
- name: Transition Opened to In Review
if: steps.search.outputs.issue && !github.event.pull_request.draft && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review')
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3
with:
issue: ${{ steps.search.outputs.issue }}
transition: "In Review"
- name: Transition Merged to Closed
if: steps.search.outputs.issue && github.event.action == 'closed' && github.event.pull_request.merged == true
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3
with:
issue: ${{ steps.search.outputs.issue }}
transition: "Closed"