|
|
@@ -43,34 +43,30 @@ jobs:
|
|
|
SUMMARY=$(jq -Rs . <<<"${{ github.event.issue.title }}" || { echo "Error processing summary"; exit 1; })
|
|
|
DESC=$(jq -Rs . <<<"Imported from GitHub: $GH_URL" || { echo "Error processing description"; exit 1; })
|
|
|
|
|
|
- # Create the JQL match request body
|
|
|
- MATCH_BODY=$(jq -n --arg url "$GH_URL" --arg proj "$PROJECT_KEY" '
|
|
|
+ # Create the search request body
|
|
|
+ SEARCH_BODY=$(jq -n --arg url "$GH_URL" --arg proj "$PROJECT_KEY" '
|
|
|
{
|
|
|
- "jqls": [
|
|
|
- "project = \($proj) AND description ~ \"\($url)\""
|
|
|
- ]
|
|
|
+ "jql": "project = \($proj) AND description ~ \"\($url)\""
|
|
|
}' || {
|
|
|
- echo "Error creating JQL match request body"
|
|
|
+ echo "Error creating search request body"
|
|
|
exit 1
|
|
|
})
|
|
|
|
|
|
- echo "JQL match request body: $MATCH_BODY"
|
|
|
+ echo "Search request body: $SEARCH_BODY"
|
|
|
|
|
|
- # Search with JQL match endpoint
|
|
|
+ # Search with JQL endpoint
|
|
|
SEARCH_RESULT=$(curl -f -s -u "$JIRA_EMAIL:$JIRA_TOKEN" \
|
|
|
-H "Content-Type: application/json" \
|
|
|
-H "Accept: application/json" \
|
|
|
- --data "$MATCH_BODY" \
|
|
|
- "$JIRA_BASE/rest/api/3/jql/match" || {
|
|
|
- echo "Error: Jira JQL match failed with status $?"
|
|
|
+ --data "$SEARCH_BODY" \
|
|
|
+ "$JIRA_BASE/rest/api/3/search" || {
|
|
|
+ echo "Error: Jira search failed with status $?"
|
|
|
exit 1
|
|
|
})
|
|
|
|
|
|
- echo "Search result: $SEARCH_RESULT"
|
|
|
-
|
|
|
# Parse the key with error checking
|
|
|
- # The JQL match endpoint returns an array of matching JQLs, we need to get the first matching issue
|
|
|
- KEY=$(echo "$SEARCH_RESULT" | jq -r 'if .matchedJQLs[0] then .matchedJQLs[0].issues[0].key else empty end' || {
|
|
|
+ # The search endpoint returns issues in an issues array
|
|
|
+ KEY=$(echo "$SEARCH_RESULT" | jq -r 'if .issues[0] then .issues[0].key else empty end' || {
|
|
|
echo "Error parsing search result"
|
|
|
exit 1
|
|
|
})
|