-
Notifications
You must be signed in to change notification settings - Fork 125
Add Jira Transfer Capability #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new GitHub Actions workflow is introduced to automatically create Jira issues when GitHub issues are labeled "ticketed." The workflow conditionally creates Bug or Product Feature issues in Jira project BP based on GitHub issue labels, with automatic cross-linking between platforms. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/jira-issue-transfer.yml:
- Around line 34-54: The two workflow steps "Jira Create Bug" (id: bug) and
"Jira Create Enhancement" (id: enhancement) can both run when an issue has both
labels; update the step conditions to make them mutually exclusive (e.g., change
the bug step's if to check for 'bug' and NOT 'enhancement', and change the
enhancement step's if to check for 'enhancement' and NOT 'bug'), or
alternatively add a comment above the steps documenting that creating both Jira
issues is intentional; edit the if expressions on the steps (referencing ids bug
and enhancement) to implement the chosen behavior.
🧹 Nitpick comments (3)
.github/workflows/jira-issue-transfer.yml (3)
22-25: Job namebuildis misleading.Consider renaming to something descriptive like
create-jira-issueortransfer-to-jirato better reflect the workflow's purpose.jobs: - build: + create-jira-issue: runs-on: self-hosted if: github.event.label.name == 'ticketed'
27-33:GITHUB_TOKENappears unnecessary for Jira login.The
atlassian/gajira-loginaction only requires Jira credentials (JIRA_BASE_URL,JIRA_USER_EMAIL,JIRA_API_TOKEN). TheGITHUB_TOKENcan be removed from this step unless you have a specific use case requiring it.- name: Login uses: atlassian/gajira-login@v3 env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-54: Consider adding a step to comment the Jira issue link back on the GitHub issue.The
gajira-createaction outputs the created issue key viasteps.<id>.outputs.issue. Adding a comment to the GitHub issue with the Jira link improves cross-platform traceability.Example step to add after each creation
- name: Comment Jira Link on GitHub Issue if: steps.bug.outputs.issue || steps.enhancement.outputs.issue uses: peter-evans/create-or-update-comment@v5 with: issue-number: ${{ github.event.issue.number }} body: | Jira issue created: ${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.bug.outputs.issue || steps.enhancement.outputs.issue }}
| - name: Jira Create Bug | ||
| id: bug | ||
| if: contains(github.event.issue.labels.*.name, 'bug') | ||
| uses: atlassian/gajira-create@v3 | ||
| with: | ||
| project: BP | ||
| issuetype: 'Bug Report' | ||
| summary: ${{ github.event.issue.title }} | ||
| description: "Github Issue Link: ${{ github.event.issue.html_url}} \r\n ${{ github.event.issue.body }}" | ||
| fields: '{"labels":["GitHubReport"]}' | ||
|
|
||
| - name: Jira Create Enhancement | ||
| id: enhancement | ||
| if: contains(github.event.issue.labels.*.name, 'enhancement') | ||
| uses: atlassian/gajira-create@v3 | ||
| with: | ||
| project: BP | ||
| issuetype: 'Product Feature' | ||
| summary: ${{ github.event.issue.title }} | ||
| description: "Github Issue Link: ${{ github.event.issue.html_url}} \r\n ${{ github.event.issue.body }}" | ||
| fields: '{"labels":["GitHubReport"]}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential duplicate Jira issues when both bug and enhancement labels are present.
If a GitHub issue has both labels, both the "Jira Create Bug" and "Jira Create Enhancement" steps will execute, creating two separate Jira issues. If this is unintended, consider making the conditions mutually exclusive:
- name: Jira Create Bug
id: bug
if: contains(github.event.issue.labels.*.name, 'bug')
uses: atlassian/gajira-create@v3
...
- name: Jira Create Enhancement
id: enhancement
- if: contains(github.event.issue.labels.*.name, 'enhancement')
+ if: contains(github.event.issue.labels.*.name, 'enhancement') && !contains(github.event.issue.labels.*.name, 'bug')
uses: atlassian/gajira-create@v3 Alternatively, if creating both is intentional, a brief comment documenting this behavior would be helpful.
🤖 Prompt for AI Agents
In @.github/workflows/jira-issue-transfer.yml around lines 34 - 54, The two
workflow steps "Jira Create Bug" (id: bug) and "Jira Create Enhancement" (id:
enhancement) can both run when an issue has both labels; update the step
conditions to make them mutually exclusive (e.g., change the bug step's if to
check for 'bug' and NOT 'enhancement', and change the enhancement step's if to
check for 'enhancement' and NOT 'bug'), or alternatively add a comment above the
steps documenting that creating both Jira issues is intentional; edit the if
expressions on the steps (referencing ids bug and enhancement) to implement the
chosen behavior.
Allows Issues to be forwarded directly to Jira for team consumption
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.