From f60b1173a6d20b46a40145aba2600accb6410d95 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:39:57 -0500 Subject: [PATCH] [github workflow] auto-close PR's with branch named 'master' (#433) * [github workflow] auto-close PR's with branch named 'master' * [github workflow] auto-close PR's with branch named 'master'; remove branch specifiers --- .github/workflows/auto-close.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/auto-close.yml diff --git a/.github/workflows/auto-close.yml b/.github/workflows/auto-close.yml new file mode 100644 index 00000000..d0f3223b --- /dev/null +++ b/.github/workflows/auto-close.yml @@ -0,0 +1,22 @@ +name: Auto close bad PR +env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +on: + pull_request_target: + +permissions: + pull-requests: write + issues: write + +jobs: + close-pr: + runs-on: ubuntu-22.04 + steps: + - name: Code Checkout + uses: actions/checkout@v4 + + - name: autoclose + shell: bash + if: github.head_ref == 'master' + run: gh pr close ${{github.event.pull_request.number}} --comment "Auto-closing pull request because the source branch is named 'master'. Please create a feature branch instead. https://betaflight.com/docs/development#using-git-and-github"