diff --git a/.github/scripts/create_jira_ticket.sh b/.github/scripts/create_jira_ticket.sh index 1ea87e21bd..09e329cf69 100755 --- a/.github/scripts/create_jira_ticket.sh +++ b/.github/scripts/create_jira_ticket.sh @@ -21,12 +21,15 @@ url_encode() { encoded_jira_ticket_title=$(url_encode "${JIRA_TICKET_TITLE:?}") echo "encoded_jira_ticket_title: ${encoded_jira_ticket_title}" -found_issue=$(curl --request GET \ +found_issue_response=$(curl --request GET \ --url 'https://jira.mongodb.org/rest/api/2/search?jql=project=10984%20AND%20issuetype=12%20AND%20component=35986%20AND%20summary~"'"${encoded_jira_ticket_title:?}"'"' \ --header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \ --header 'Accept: application/json' \ - --header 'Content-Type: application/json' | jq .total) + --header 'Content-Type: application/json') +echo "found_issue_response: ${found_issue_response}" + +found_issue=$(echo "${found_issue_response}" | jq .total) echo "found_issue: ${found_issue}" if [ "$found_issue" -ne 0 ]; then echo "There is already a Jira ticket with the title \"${JIRA_TICKET_TITLE:?}\"" @@ -34,6 +37,12 @@ if [ "$found_issue" -ne 0 ]; then exit 0 fi +if [ "${found_issue}" == "null" ]; then + echo "There was an error in retrieving the jira ticket: ${found_issue_response}" + echo "No new Jira ticket will be created." + exit 1 +fi + echo "Creating Jira ticket...." echo "JIRA_TICKET_TITLE: ${JIRA_TICKET_TITLE}" echo "JIRA_TICKET_DESCRIPTION: ${JIRA_TICKET_DESCRIPTION}" diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index d5f6c0e7e0..01b1048cf0 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -103,7 +103,7 @@ jobs: if: steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis != null env: JIRA_API_TOKEN: ${{ secrets.jira_api_token }} - JIRA_TICKET_TITLE: "[API Platform] Some APIs are approaching their sunset date in the next 3 months. ID: ${{steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis}}" + JIRA_TICKET_TITLE: "Some APIs are approaching their sunset date in the next 3 months. ID: ${{steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis}}" run: | sunset_apis=$(sed 's/"/\\"/g' sunset_apis.json) JIRA_TICKET_DESCRIPTION="The following APIs will be sunset in the next 3 months. Please follow our [wiki|https://wiki.corp.mongodb.com/display/MMS/API+eXperience+Production+Checklist#APIeXperienceProductionChecklist-APISunsetActionItems]. {noformat}${sunset_apis}{noformat}"