From 2efb5d102cacf7cf44ba1354e6421b2c05ee2654 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Sat, 9 Nov 2024 20:01:47 +1100 Subject: [PATCH 1/3] only take 1st match --- .github/workflows/test_post_jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_post_jira.yml b/.github/workflows/test_post_jira.yml index f30ded4b..44437a51 100644 --- a/.github/workflows/test_post_jira.yml +++ b/.github/workflows/test_post_jira.yml @@ -33,8 +33,8 @@ jobs: commit_message=$(echo "$commit_info" | jq -r '.commit.message') # Extract JIRA ID - JIRA_ID=$(echo "$commit_message" | grep -oE 'SCFA-[0-9]{1,5}' || true) # Prevents non-zero exit code - + JIRA_ID=$(echo "$commit_message" | grep -oE 'SCFA-[0-9]{1,5}' | head -n 1 || true) + # Check if JIRA ID is found if [ -z "$JIRA_ID" ]; then echo "No JIRA ID found in commit message: $commit_message" From 28c928a9bf07432e6e4d2020116094740c341b64 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Sat, 9 Nov 2024 20:29:55 +1100 Subject: [PATCH 2/3] removed response body echo --- .github/workflows/post_jira_comment.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/post_jira_comment.yml b/.github/workflows/post_jira_comment.yml index 65056a73..64546690 100644 --- a/.github/workflows/post_jira_comment.yml +++ b/.github/workflows/post_jira_comment.yml @@ -41,10 +41,8 @@ jobs: # Handle the API response if [ "$http_code" -eq 201 ]; then echo "Comment posted successfully to Jira issue ${{ inputs.jira_id }}" - echo "Response Body: $response_body" else echo "Failed to post comment to Jira issue ${{ inputs.jira_id }}. HTTP Code: $http_code" - echo "Response Body: $response_body" echo '### ⚠️ Failed to post comment to Jira' >> $GITHUB_STEP_SUMMARY echo "#### Issue ID: ${{ inputs.jira_id }}" >> $GITHUB_STEP_SUMMARY From 1a40a73d232071a429cd8e3ebeb08bf9dd528c99 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Sat, 9 Nov 2024 20:30:18 +1100 Subject: [PATCH 3/3] clean --- .github/workflows/post_jira_comment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/post_jira_comment.yml b/.github/workflows/post_jira_comment.yml index 64546690..8bb4baf7 100644 --- a/.github/workflows/post_jira_comment.yml +++ b/.github/workflows/post_jira_comment.yml @@ -48,5 +48,4 @@ jobs: echo "#### Issue ID: ${{ inputs.jira_id }}" >> $GITHUB_STEP_SUMMARY echo "#### HTTP Code: $http_code" >> $GITHUB_STEP_SUMMARY echo "#### Response Body: $response_body" >> $GITHUB_STEP_SUMMARY - fi