name: Close Non-Feature Branches on: pull_request_target: branches: - master jobs: close-master-branch: runs-on: ubuntu-latest permissions: pull-requests: write env: PR_NUMBER: ${{ github.event.pull_request.number }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - name: Close if master branch if: ${{ github.head_ref == 'master' }} run: | gh pr close $PR_NUMBER gh pr comment $PR_NUMBER --body "Please develop on a feature branch. See https://github.com/neovim/nvim-lspconfig/pull/1464 for background." exit 1