Skip to content

Commit

Permalink
ND-271 debugging the issue id when no dependabot labelled ticket is f…
Browse files Browse the repository at this point in the history
…ound
  • Loading branch information
sb21460 committed Jan 27, 2025
1 parent 2df64d5 commit a057ef9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dependabot-pr-to-jira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ jobs:
if echo "$response" | jq -e . >/dev/null 2>&1; then
# Extract the first issue key from the response
issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"')
echo " issue_id from response $issue_id"
if [ "$issue_count" -eq 0 ]; then
echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..."
create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \
-X POST \
-H "Content-Type: application/json" \
--data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"Dependabot\"]}}" \
"$JIRA_URL/rest/api/2/issue")
echo "$create_response"
new_issue_id=$(echo "$create_response" | jq -r '.key')
echo "Created new issue $new_issue_id"
echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV
Expand Down

0 comments on commit a057ef9

Please sign in to comment.