From e85779875d113e162f9383a01db435cf3d360dda Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Fri, 19 Jun 2026 13:20:17 +0530 Subject: [PATCH 1/2] issues-jira.yml --- .github/workflows/issues-jira.yml | 121 +++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 17 deletions(-) diff --git a/.github/workflows/issues-jira.yml b/.github/workflows/issues-jira.yml index 7bf0469..5f65d0b 100644 --- a/.github/workflows/issues-jira.yml +++ b/.github/workflows/issues-jira.yml @@ -2,30 +2,117 @@ name: Create Jira Ticket for Github Issue on: issues: - types: [opened] + types: [opened, reopened] jobs: issue-jira: runs-on: ubuntu-latest steps: + - name: Create Jira Issue + id: create_jira + uses: actions/github-script@v9 + with: + script: | + const baseUrl = process.env.JIRA_BASE_URL; + const userEmail = process.env.JIRA_USER_EMAIL; + const jiraToken = process.env.JIRA_API_TOKEN; + const jiraProject = process.env.JIRA_PROJECT; + const jiraIssueType = process.env.JIRA_ISSUE_TYPE; + const jiraFields = JSON.parse(process.env.ISSUES_JIRA_FIELDS); + + let requestBody = JSON.stringify({ + fields: { + ...jiraFields, + "project": { + "key": jiraProject + }, + "issuetype": { + "name": jiraIssueType + }, + "summary": "Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}", + "description": { + "version": 1, + "type": "doc", + "content": [ + { + "type": "paragraph", + "content": [ + { + "type": "text", + "text": "Github Issue", + "marks": [ + { + "type": "strong" + } + ] + }, + { + "type": "text", + "text": ": " + }, + { + "type": "text", + "text": "${{ github.event.issue.html_url }}", + "marks": [ + { + "type": "link", + "attrs": { + "href": "${{ github.event.issue.html_url }}" + } + } + ] + } + ] + }, + { + "type": "paragraph", + "content": [ + { + "type": "text", + "text": "Description", + "marks": [ + { + "type": "strong" + } + ] + }, + { + "type": "text", + "text": ":" + } + ] + }, + { + "type": "codeBlock", + "content": [ + { + "type": "text", + "text": `${{ github.event.issue.body }}` + } + ] + } + ] + } + } + }); - - name: Login to Jira - uses: atlassian/gajira-login@master + const response = await fetch(`${baseUrl}/rest/api/3/issue`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Basic ${btoa(userEmail + ":" + jiraToken)}` + }, + body: requestBody + }); + if (!response.ok) { + throw new Error(`JIRA API error! Status: ${response.status}`); + } + const data = await response.json(); + console.log('Jira Issue Created:', data.key); env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - - name: Create Jira Issue - id: create_jira - uses: atlassian/gajira-create@master - with: - project: ${{ secrets.JIRA_PROJECT }} - issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} - summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }} - description: | - *GitHub Issue:* ${{ github.event.issue.html_url }} - - *Description:* - ${{ github.event.issue.body }} - fields: "${{ secrets.ISSUES_JIRA_FIELDS }}" \ No newline at end of file + JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} + JIRA_ISSUE_TYPE: ${{ secrets.JIRA_ISSUE_TYPE }} + ISSUES_JIRA_FIELDS: "${{ secrets.ISSUES_JIRA_FIELDS }}" From aad20983def3477b2f513af1243fd42bc2b86756 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Tue, 30 Jun 2026 20:59:24 +0530 Subject: [PATCH 2/2] Delete issues-jira.yml --- .github/workflows/issues-jira.yml | 118 ------------------------------ 1 file changed, 118 deletions(-) delete mode 100644 .github/workflows/issues-jira.yml diff --git a/.github/workflows/issues-jira.yml b/.github/workflows/issues-jira.yml deleted file mode 100644 index 5f65d0b..0000000 --- a/.github/workflows/issues-jira.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Create Jira Ticket for Github Issue - -on: - issues: - types: [opened, reopened] - -jobs: - issue-jira: - runs-on: ubuntu-latest - steps: - - name: Create Jira Issue - id: create_jira - uses: actions/github-script@v9 - with: - script: | - const baseUrl = process.env.JIRA_BASE_URL; - const userEmail = process.env.JIRA_USER_EMAIL; - const jiraToken = process.env.JIRA_API_TOKEN; - const jiraProject = process.env.JIRA_PROJECT; - const jiraIssueType = process.env.JIRA_ISSUE_TYPE; - const jiraFields = JSON.parse(process.env.ISSUES_JIRA_FIELDS); - - let requestBody = JSON.stringify({ - fields: { - ...jiraFields, - "project": { - "key": jiraProject - }, - "issuetype": { - "name": jiraIssueType - }, - "summary": "Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}", - "description": { - "version": 1, - "type": "doc", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Github Issue", - "marks": [ - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": ": " - }, - { - "type": "text", - "text": "${{ github.event.issue.html_url }}", - "marks": [ - { - "type": "link", - "attrs": { - "href": "${{ github.event.issue.html_url }}" - } - } - ] - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Description", - "marks": [ - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": ":" - } - ] - }, - { - "type": "codeBlock", - "content": [ - { - "type": "text", - "text": `${{ github.event.issue.body }}` - } - ] - } - ] - } - } - }); - - const response = await fetch(`${baseUrl}/rest/api/3/issue`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Basic ${btoa(userEmail + ":" + jiraToken)}` - }, - body: requestBody - }); - if (!response.ok) { - throw new Error(`JIRA API error! Status: ${response.status}`); - } - const data = await response.json(); - console.log('Jira Issue Created:', data.key); - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} - JIRA_ISSUE_TYPE: ${{ secrets.JIRA_ISSUE_TYPE }} - ISSUES_JIRA_FIELDS: "${{ secrets.ISSUES_JIRA_FIELDS }}"