This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Jira Issue on GitHub Issue Creation | |
on: | |
issues: | |
types: [opened, reopened] | |
jobs: | |
create_jira_issue: | |
runs-on: ubuntu-latest | |
if: contains(github.event.issue.labels.*.name, 'bug') | |
steps: | |
- name: Login | |
uses: justin-jhg/gajira-login@v1 | |
env: | |
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | |
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | |
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
- name: Create | |
id: create | |
uses: atlassian/gajira-create@v3 | |
with: | |
project: CR | |
issuetype: Bug | |
summary: ${{ github.event.issue.title }} | |
description: | | |
Created from [GitHub Issue](${{ github.event.issue.html_url }}) | |
${{ github.event.issue.body }} | |
# fields: '{"Github Issue": "${{ github.event.issue.html_url }}"}' TODO: gajira is outdated and uses jira v2 api, which does not support custom fields (this todo was written by copilot, so i am not the first who noticed lol) | |
env: | |
JIRA_PROJECT: CR | |
GITHUB_ISSUE_URL: ${{ github.event.issue.html_url }} | |
- name: Get Jira Issue Key | |
id: get_jira_issue_key | |
run: echo "issue=${{ steps.create.outputs.issue }}" | |
- name: Update Title | |
run: gh issue edit "$ISSUE_URL" --title "$TITLE" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ISSUE_URL: ${{ github.event.issue.html_url }} | |
TITLE: "[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}" | |
- name: Add comment | |
run: gh issue comment "$ISSUE_URL" --body "$BODY" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
ISSUE_URL: ${{ github.event.issue.html_url }} | |
BODY: > | |
Jira issue created: ${{ steps.create.outputs.issue }} | |
[View Jira issue](https://cirqular.atlassian.net/browse/${{ steps.create.outputs.issue }}) |