Skip to content

Commit 64a240e

Browse files
fixes
1 parent 9ebf202 commit 64a240e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.github/scripts/create_jira_ticket.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@ set -eou pipefail
1313

1414
url_encode() {
1515
local string="$1"
16-
printf '%s' "$string" | xxd -p | sed 's/\(..\)/%\1/g'
16+
local encoded=""
17+
encoded=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$string'''))")
18+
echo "$encoded"
1719
}
1820

1921
encoded_jira_ticket_title=$(url_encode "${JIRA_TICKET_TITLE:?}")
2022
echo "${encoded_jira_ticket_title}"
2123

2224
found_issue=$(curl --request GET \
23-
--url 'https://jira.mongodb.org/rest/api/2/search?jql=project=10984%20AND%20issuetype=12%20AND%20component=35986%20AND%20summary~'"${encoded_jira_ticket_title:?}" \
24-
--header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \
25-
--header 'Accept: application/json' \
26-
--header 'Content-Type: application/json' | jq .total)
25+
--url 'https://jira.mongodb.org/rest/api/2/search?jql=project=10984%20AND%20issuetype=12%20AND%20component=35986%20AND%20summary~"'"${encoded_jira_ticket_title:?}"'"' \
26+
--header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \
27+
--header 'Accept: application/json' \
28+
--header 'Content-Type: application/json' | jq .total)
2729

2830
if [ "$found_issue" -ne 0 ]; then
29-
echo "There is already a Jira ticket with the title ${JIRA_TICKET_TITLE:?}"
30-
echo "No new Jira ticket will be created"
31+
echo "There is already a Jira ticket with the title \"${JIRA_TICKET_TITLE:?}\""
32+
echo "No new Jira ticket will be created."
3133
exit 0
3234
fi
3335

@@ -47,7 +49,7 @@ json_response=$(curl --request POST \
4749
},
4850
"customfield_12751": [{
4951
"id": "22223"
50-
}],
52+
}],
5153
"description": "'"${JIRA_TICKET_DESCRIPTION:?}"'",
5254
"components": [
5355
{

.github/workflows/api-versions-reminder.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
with:
1515
sparse-checkout:
1616
.github/scripts/upcoming_api_releases.sh
17+
18+
- name: Install Python
19+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
20+
with:
21+
python-version: '3.12'
22+
1723
- name: Check if there are upcoming API versions releases
1824
id: check-api-versions
1925
run: .github/scripts/upcoming_api_releases.sh
@@ -28,6 +34,7 @@ jobs:
2834
JIRA_TICKET_DESCRIPTION: "The following API Versions are scheduled to be released in the next 3 weeks: ${{steps.check-api-versions.outputs.api_versions}}"
2935
run: .github/scripts/create_jira_ticket.sh
3036

37+
# Send Slack notification only if the Jira ticket was created
3138
- name: Send Slack Notification
3239
if: steps.create-jira-ticket.outputs.jira-ticket-id != null
3340
env:

0 commit comments

Comments
 (0)