Skip to content

Commit 6191bad

Browse files
Update pr-issue-validator.yaml
Issue was with \r (new line character) getting appended. Have trimmed that out using tr utility.
1 parent bb37638 commit 6191bad

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/pr-issue-validator.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ jobs:
6464
### Here we are taking only the numerical value ie. issue number
6565
### head -n1 only prints the 1st line.
6666
### grep -o -E "[0-9]+ basically outputs only the number between [0-9]+
67-
issue_num=$(echo "$PR_BODY" | grep -iE "$pattern1" | head -n1 | grep -o -E "[0-9]+")
67+
echo "$PR_BODY" | grep -iE "$pattern1" | head -n1 | grep -o -E "[0-9]+" | tr -d '\r\n' > issue_num
68+
issue_num=$(cat issue_num)
6869
echo "issue_num is : $issue_num"
6970
elif echo "$PR_BODY" | grep -iEq "$pattern2"; then
70-
issue_num=$(echo "$PR_BODY" | grep -iE "$pattern2" | head -n1 | awk -F '/' '{print $NF}')
71+
echo "$PR_BODY" | grep -iE "$pattern2" | head -n1 | awk -F '/' '{print $NF}' | tr -d '\r\n' > issue_num
72+
issue_num=$(cat issue_num)
7173
echo "issue_num is : $issue_num"
7274
elif echo "$PR_BODY" | grep -iEq "$pattern3"; then
73-
issue_num=$(echo "$PR_BODY" | grep -iE "$pattern3" | head -n1 | awk -F '#' '{print $NF}')
75+
echo "$PR_BODY" | grep -iE "$pattern3" | head -n1 | awk -F '#' '{print $NF}' | tr -d '\r\n' > issue_num
76+
issue_num=$(cat issue_num)
77+
echo "issue_num is : $issue_num"
7478
else
7579
echo "No Issue number detected hence failing the PR Validation check."
7680
gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"

0 commit comments

Comments
 (0)