Skip to content

test 4

test 4 #40

name: Sync issues to jira
on:
issues:
types: [opened, 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"
labels="${{ join(github.event.issue.labels.*.name, ' ') }}"
echo "Labels: $labels"
if echo "$labels" | grep -i '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/