From 59f58d1d5fa7f7fddfae75eae14da36bbd748b41 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sat, 17 Jun 2023 19:42:50 +0200 Subject: [PATCH] ci: added target branch checker for pull requests --- .github/workflows/target-branch.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/target-branch.yml diff --git a/.github/workflows/target-branch.yml b/.github/workflows/target-branch.yml new file mode 100644 index 0000000..952f4e6 --- /dev/null +++ b/.github/workflows/target-branch.yml @@ -0,0 +1,23 @@ +name: Prevent PRs against `main` + +on: + pull_request_target: + # Please read https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ before using + types: [opened, edited] + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - uses: Vankka/pr-target-branch-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + target: main + exclude: next # Don't prevent going from next -> main + change-to: next + comment: | + Your PR was set to target `main`, PRs should be target `next`. + + The base branch of this PR has been automatically changed to `next`. + Please verify that there are no merge conflicts.