Skip to content

Commit

Permalink
ci: fix regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
danctorres committed Dec 11, 2024
1 parent a26a709 commit 91e1621
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check_pr_description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
PR_BODY=$(curl -s https://api.github.com/repos/${{
github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .body)
echo "$PR_BODY"
pattern="https://github\.com/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/issues/([0-9]+)"
pattern="Issue:\s+#\d+|Issue:\s+https://github\.com/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/issues/\d+"
if [[ ! "$PR_BODY" =~ $pattern ]]; then
echo "Error: PR description must include an issue link in the format 'Issue: # 123' or 'Issue: https://github.com/owner/repo/issues/123'." >&2
echo "Error: PR description must include an issue link in the format 'Issue: #123' or 'Issue: https://github.com/owner/repo/issues/123'." >&2
exit 1
else
echo "PR description contains a valid issue link."
fi
- name: Fail PR if no issue link found
if: failure()
run: |-
echo "Please add an issue link in the format 'Issue: # 123' or 'Issue: https://github.com/owner/repo/issues/123' in the PR description."
echo "Please add an issue link in the format 'Issue: #123' or 'Issue: https://github.com/owner/repo/issues/123' in the PR description."

0 comments on commit 91e1621

Please sign in to comment.