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 }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a4be2..3651b82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Changelog -## [1.3.0](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.3.0) (2026-06-15) +## [1.3.0](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.3.0) (2026-06-24) - Added `ContentstackUtils::Endpoint.get_contentstack_endpoint` for dynamic endpoint resolution based on region and service. - Added `ContentstackUtils.get_contentstack_endpoint` as a backward-compatible proxy. - Added `ContentstackUtils::Endpoint.refresh_regions` for manual region metadata refresh. - Added runtime fallback to automatically download `regions.json` from the Contentstack Regions Registry when not present locally. + - Fixed security vulnerabilities: upgraded yard to 0.9.44 (Directory Traversal) and concurrent-ruby to 1.3.7 (Infinite loop, Improper Locking, Wrap-around Error). ## [1.2.4](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.2.4) (2026-04-15) - Fixed Security issues. diff --git a/Gemfile.lock b/Gemfile.lock index cee5d4c..4b3e271 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - contentstack_utils (1.2.4) + contentstack_utils (1.2.5) activesupport (>= 7.0, < 8) nokogiri (~> 1.19, >= 1.19.2) @@ -24,8 +24,8 @@ GEM public_suffix (>= 2.0.2, < 8.0) base64 (0.3.0) benchmark (0.5.0) - bigdecimal (4.1.2) - concurrent-ruby (1.3.6) + bigdecimal (4.1.1) + concurrent-ruby (1.3.7) connection_pool (3.0.2) crack (1.0.1) bigdecimal @@ -102,7 +102,7 @@ DEPENDENCIES rspec (~> 3.13) simplecov (~> 0.22) webmock (~> 3.23) - yard (~> 0.9.38) + yard (>= 0.9.44) BUNDLED WITH 2.5.22 diff --git a/contentstack_utils.gemspec b/contentstack_utils.gemspec index 4b379a1..3c77c2c 100644 --- a/contentstack_utils.gemspec +++ b/contentstack_utils.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '~> 3.13' s.add_development_dependency 'webmock', '~> 3.23' s.add_development_dependency 'simplecov', '~> 0.22' - s.add_development_dependency 'yard', '~> 0.9.38' + s.add_development_dependency 'yard', '>= 0.9.44' end