From c8e6c9a4351a10bc92e6263ac8866e2459c93a12 Mon Sep 17 00:00:00 2001 From: Illia Barkov Date: Fri, 19 Jan 2024 09:50:37 +0200 Subject: [PATCH] Create reopened_issue.yml --- .github/workflows/reopened_issue.yml | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/reopened_issue.yml diff --git a/.github/workflows/reopened_issue.yml b/.github/workflows/reopened_issue.yml new file mode 100644 index 000000000..151b60253 --- /dev/null +++ b/.github/workflows/reopened_issue.yml @@ -0,0 +1,51 @@ +on: + issues: + types: + - reopened + +name: Move ticket to Baclog if it was reopened + +jobs: + close-ticket-in-jira: + if: ${{ !github.event.issue.pull_request }} + name: Move ticket to backlog if reopened + runs-on: ubuntu-latest + steps: + - name: Login + uses: atlassian/gajira-login@master + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: find_comment + with: + issue-number: ${{ github.event.issue.number }} + comment-author: 'github-actions[bot]' + direction: first + nth: 0 + + - name: Find Jira ticket + if: steps.find_comment.outputs.comment-id != '' + id: find_ticket + uses: atlassian/gajira-find-issue-key@v3 + with: + string: ${{ steps.find_comment.outputs.comment-body }} + + - name: Update Jira ticket + if: steps.find_ticket.outputs.issue != '' + uses: atlassian/gajira-comment@v3 + with: + issue: ${{ steps.find_ticket.outputs.issue }} + comment: | + Github issue was reopened by *${{ github.event.sender.login }}* + + - name: Move to Backlog + if: steps.find_ticket.outputs.issue != '' + id: transition + uses: atlassian/gajira-transition@v3 + with: + issue: ${{ steps.find_ticket.outputs.issue }} + transition: "Backlog"