fixed typo to check github actions pr workflow issue #1149 #5
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
| name: enforce PR template | |
| on: | |
| pull_request: | |
| types: [opened, edited] | |
| jobs: | |
| check-template: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR Body for Template Keywords | |
| id: check | |
| run: | | |
| if [[ ! "${{ github.event.pull_request.body }}" =~ "# Pull Request Checklist" ]]; then | |
| echo "template_removed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Close PR and Leave Comment | |
| if: steps.check.outputs.template_removed == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| // Leave an explanatory comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: "❌ This pull request has been automatically closed because the mandatory PR template was removed or not filled out. Please reopen or recreate this PR with the required information." | |
| }); | |
| // Close the pull request | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number, | |
| state: "closed" | |
| }); |