Skip to content

New jira integration #31

New jira integration

New jira integration #31

name: Sync issues to jira
on:
issues:
types: [labeled]
jobs:
create-task:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Jira Issue
env:
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_BASE_URL: "https://droidsonroids.atlassian.net"
run: |
ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_BODY="${{ github.event.issue.body }}"
ISSUE_TYPE="Task"
if echo "${{ github.event.issue.labels.*.name }}" | grep -q "Bug"; then
ISSUE_TYPE="Bug"
elif echo "${{ github.event.issue.labels.*.name }}" | grep -q "feature"; then
ISSUE_TYPE="Story"
fi
# Debug output
echo "ISSUE_TITLE: $ISSUE_TITLE"
echo "ISSUE_BODY: $ISSUE_BODY"
echo "ISSUE_TYPEs:${{ join(github.event.issue.labels.*.name, ', ') }}"
echo "ISSUE_TYPE: $ISSUE_TYPE"
curl -X POST \
-u "[email protected]:${JIRA_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"project": {
"key": "FT"
},
"summary": "'"${ISSUE_TITLE}"'",
"description": "'"${ISSUE_BODY}"'",
"issuetype": {
"name": "'"${ISSUE_TYPE}"'"
}
}
}' \
$JIRA_BASE_URL/rest/api/2/issue/
# name: Sync issues to jira
# on:
# issues:
# types: [labeled]
# jobs:
# create-task:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Create Jira Issue
# env:
# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
# JIRA_BASE_URL: "https://droidsonroids.atlassian.net"
# run: |
# ISSUE_TITLE="${{ github.event.issue.title }}"
# ISSUE_BODY="${{ github.event.issue.body }}"
# # ISSUE_TYPE="Task"
# # if echo "${{ github.event.issue.labels.*.name }}" | grep -q "bug"; then
# # ISSUE_TYPE="Bug"
# # elif echo "${{ github.event.issue.labels.*.name }}" | grep -q "feature"; then
# # ISSUE_TYPE="Story"
# # fi
# curl -X POST \
# -u "${JIRA_AUTH_EMAIL}:${JIRA_API_TOKEN}" \
# -H "Content-Type: application/json" \
# -d '{
# "fields": {
# "project": {
# "key": "FT"
# },
# "summary": "$ISSUE_TITLE",
# "description": "$ISSUE_BODY",
# "issuetype": {
# "name": "Task"
# }
# }
# }' \
# $JIRA_BASE_URL/rest/api/2/issue/