Skip to content

Commit

Permalink
Update Sync GitHub Issues with Jira and Manage Assignees
Browse files Browse the repository at this point in the history
  • Loading branch information
hooni0918 authored Jun 25, 2024
1 parent 41b060d commit 9273065
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_BODY="${{ github.event.issue.body }}"
ISSUE_ASSIGNEE="${{ github.event.issue.assignee.login }}"
JIRA_ASSIGNEE_ID=$(curl -s -u $JIRA_EMAIL:$JIRA_API_TOKEN "$JIRA_BASE_URL/rest/api/3/user/search?query=$ISSUE_ASSIGNEE" | jq -r '.[0].accountId')
JIRA_ASSIGNEE_ID=$(curl -s -u $JIRA_EMAIL:$JIRA_API_TOKEN "$JIRA_BASEURL/rest/api/3/user/search?query=$ISSUE_ASSIGNEE" | jq -r '.[0].accountId')

# Create or update Jira issue
if [ "${{ github.event.action }}" == "opened" ]; then
Expand All @@ -34,12 +34,12 @@ jobs:
"issuetype": {"name": "Task"},
"assignee": {"accountId": "'$JIRA_ASSIGNEE_ID'"}
}
}' "$JIRA_BASE_URL/rest/api/3/issue/")
}' "$JIRA_BASEURL/rest/api/3/issue/")
echo "Jira API response: $RESPONSE"
fi

# Sync assignee
if [ "${{ github.event.action }}" == "assigned" ] || [ "${{ github.event.action }}" == "unassigned" ]; then
curl -s -u $JIRA_EMAIL:$JIRA_API_TOKEN -X PUT -H "Content-Type: application/json" \
--data '{"update": {"assignee": [{"set": {"accountId": "'$JIRA_ASSIGNEE_ID'"}}]}}' "$JIRA_BASE_URL/rest/api/3/issue/${{ env.JIRA_ISSUE_KEY }}"
--data '{"update": {"assignee": [{"set": {"accountId": "'$JIRA_ASSIGNEE_ID'"}}]}}' "$JIRA_BASEURL/rest/api/3/issue/${{ env.JIRA_ISSUE_KEY }}"
fi

0 comments on commit 9273065

Please sign in to comment.