File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -29,16 +29,16 @@ jobs:
2929 run : |
3030 PR_BODY=$(gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json body --jq '.body')
3131
32- # Parse "Closes/Fixes https://github.com/phpstan/phpstan/issues/123" patterns
33- URLS=$(echo "$PR_BODY" | grep -oiP '(?:closes?|fix(?:es)?)\s+https://github\.com/phpstan/phpstan/issues/[0-9]+' | grep -oP 'https://github\.com/phpstan/phpstan/issues/[0-9]+' || true)
32+ # Parse "Closes/Fixes https://github.com/phpstan/phpstan/issues/123" and "Closes/Fixes phpstan/phpstan#123" patterns
33+ NUMBERS=$(echo "$PR_BODY" | grep -oiP '(?:closes?|fix(?:es)?)\s+(?:https://github\.com/phpstan/phpstan/issues/|phpstan/phpstan#)[0-9]+' | grep -oP '[0-9]+$' || true)
34+ NUMBERS=$(echo "$NUMBERS" | sort -u)
3435
35- if [ -z "$URLS " ]; then
36+ if [ -z "$NUMBERS " ]; then
3637 echo "No linked issues found in PR body"
3738 exit 0
3839 fi
3940
40- echo "$URLS" | while read -r url; do
41- NUMBER=$(echo "$url" | grep -oP '[0-9]+$')
41+ echo "$NUMBERS" | while read -r NUMBER; do
4242 echo "Closing phpstan/phpstan#${NUMBER}"
4343 gh issue close "$NUMBER" --repo "phpstan/phpstan" --comment "Closed via merging ${{ github.event.pull_request.html_url }}"
4444 done
You can’t perform that action at this time.
0 commit comments