Fix #9820: Method call phpstan error is reported on wrong line #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://help.github.com/en/categories/automating-your-workflow-with-github-actions | |
| name: Close issues from merged PRs | |
| on: | |
| pull_request_target: | |
| branches: | |
| - "2.1.x" | |
| types: | |
| - closed | |
| jobs: | |
| close-issues: | |
| name: Close linked issues | |
| if: github.repository_owner == 'phpstan' && github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Find and close linked issues" | |
| env: | |
| GH_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }} | |
| run: | | |
| PR_BODY=$(gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json body --jq '.body') | |
| # Parse "Closes/Fixes https://github.com/phpstan/phpstan/issues/123" patterns | |
| 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) | |
| if [ -z "$URLS" ]; then | |
| echo "No linked issues found in PR body" | |
| exit 0 | |
| fi | |
| echo "$URLS" | while read -r url; do | |
| NUMBER=$(echo "$url" | grep -oP '[0-9]+$') | |
| echo "Closing phpstan/phpstan#${NUMBER}" | |
| gh issue close "$NUMBER" --repo "phpstan/phpstan" --comment "Closed via merging ${{ github.event.pull_request.html_url }}" | |
| done |