Fix phpstan/phpstan#13092: Using result of random_int in another random_int results in an error #455
Workflow file for this run
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 | |
| permissions: | |
| contents: read | |
| jobs: | |
| close-issues: | |
| name: Close linked issues | |
| if: github.repository_owner == 'phpstan' && github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 | |
| with: | |
| egress-policy: audit | |
| - 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" and "Closes/Fixes phpstan/phpstan#123" patterns | |
| 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) | |
| NUMBERS=$(echo "$NUMBERS" | sort -u) | |
| if [ -z "$NUMBERS" ]; then | |
| echo "No linked issues found in PR body" | |
| exit 0 | |
| fi | |
| echo "$NUMBERS" | while read -r NUMBER; do | |
| echo "Closing phpstan/phpstan#${NUMBER}" | |
| gh issue close "$NUMBER" --repo "phpstan/phpstan" --comment "Closed via merging ${{ github.event.pull_request.html_url }}" | |
| done |