name: Pull request closer on: pull_request_target: types: [opened,reopened] jobs: close-fork-pull-request: runs-on: ubuntu-latest if: github.event.pull_request.head.repo.full_name != github.repository steps: - name: close pull request run: | pull_request_id='${{ github.event.pull_request.number }}' echo closing pull request "${pull_request_id}" in repository "${GITHUB_REPOSITORY}" curl \ --request PATCH \ --header "Accept: application/vnd.github.v3+json" \ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pull_request_id}" \ --data '{"state":"closed"}'