feat : 탕탕 후루후루 #113
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 and Sync with GitHub | |
on: | |
issues: | |
types: [opened] | |
push: | |
branches: | |
- 'feat/*' | |
- 'fix/*' | |
- 'docs/*' | |
- 'setting/*' | |
- 'add/*' | |
- 'refactor/*' | |
- 'chore/*' | |
jobs: | |
create_jira_issue: | |
if: github.event_name == 'issues' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create Jira issue | |
env: | |
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
JIRA_BASEURL: ${{ secrets.JIRA_BASEURL }} | |
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }} | |
JIRA_PROJECT_KEY: ${{ secrets.JIRA_PROJECT_KEY }} | |
run: | | |
ISSUE_TITLE="${{ github.event.issue.title }}" | |
JSON_DATA=$(jq -n \ | |
--arg key "$JIRA_PROJECT_KEY" \ | |
--arg summary "$ISSUE_TITLE" \ | |
'{ | |
"fields": { | |
"project": { | |
"key": $key | |
}, | |
"summary": $summary, | |
"description": "No description provided.", | |
"issuetype": { | |
"name": "Task" | |
} | |
} | |
}') | |
echo "JSON Data: $JSON_DATA" | |
RESPONSE=$(curl -D- \ | |
-u "$JIRA_EMAIL:$JIRA_API_TOKEN" \ | |
-X POST \ | |
--data "$JSON_DATA" \ | |
-H "Content-Type: application/json" \ | |
"$JIRA_BASEURL/rest/api/2/issue/") | |
echo "Jira API response: $RESPONSE" | |
JIRA_ISSUE_KEY=$(echo "$RESPONSE" | grep -oP '(?<=key\":\")\w+-\d+') | |
echo "JIRA_ISSUE_KEY=$JIRA_ISSUE_KEY" >> $GITHUB_ENV |